Wednesday, September 21, 2011

Change Site Collection Administrator

$webappurl = "http://portal"
$account1= "domainname\username"
$account2= "domainname\username"


$webapp = Get-SPWebApplication $webappurl
$allsites = $webapp | get-spsite -limit all


$allsites | foreach-object { Set-SPSite -owneralias $account1 -identity $_.url}
$allsites | foreach-object { Set-SPSite -secondaryowneralias $account2 -identity $_.url}

No comments:

Post a Comment