Вам нужно передать массив URL к Foreach-Object
:
'http://sharepoint/',
'http://sharepoint/site1',
'http://sharepoint/site1/1',
'http://sharepoint/site2/1' | Foreach-Object {
$web = Get-SPWeb $_
$web.CustomMasterUrl = "/_catalogs/masterpage/custom_v4.master"
$web.Update()
}
или сделай это в императивном стиле:
$urls = 'http://sharepoint/', 'http://sharepoint/site1', 'http://sharepoint/site1/1', 'http://sharepoint/site2/1'
foreach($url in $urls) {
$web = Get-SPWeb $url
$web.CustomMasterUrl = "/_catalogs/masterpage/custom_v4.master"
$web.Update()
}