Sharepoint Set Site Collection Administrator with Powershell

Tags: Sharepoint, site, collection, admin, administrator, powershell

$siteCollectionUrl = "<my site>"
$site =new-object Microsoft.SharePoint.SPSite($siteCollectionUrl)
$web = $site.RootWeb
$primarAdministrator = $web.EnsureUser("domain\sp_admin")
$site.Owner = $primarAdministrator;
Set-SpSite "<my site>" -owneralias "domain\sp_admin"
$secondayAdministrator = $web.EnsureUser("domain\sp_farm")
$site.SecondaryContact = $secondayAdministrator;
Set-SpSite "<my site>" -SecondaryOwnerAlias "domain\sp_farm"

No Comments

You must log on to comment.