Showing posts with label Set site collection admin for all sites using Powershell. Show all posts
Showing posts with label Set site collection admin for all sites using Powershell. Show all posts

Tuesday, September 17, 2013

Set site collection admin for all sites using Powershell

Powershell script to set Site Collection Administrator for all sites in a web application:

$scadmin = "domain\user"                        # Admin Domain\account
$Sites = Get-SPsite
 
foreach ($site in $Sites) {
    Set-SPSite -Identity $site -SecondaryOwnerAlias $scadmin
    }


Make sure you run this using SharePoint Management Shell and using Run as Administrator