4

How to add multiple site collection admins for a given site for secondary? I tried below but it replaces existing secondary. Any idea?

Set-SPSite –Identity $siteCollectionUrl –SecondaryOwnerAlias "domain\jdoe"
  • You can only have one primary and one secondary site collection administrator. You can add additional site administrators by going to Site Settings | Users and Permissions | Site Collections Administrators. Anyone added to this group that is not listed as the Primary or Secondary, though, will not receive email notifications, but will have full control of the site collection. – Kaylee Chatham Oct 19 '15 at 16:08
  • > There can be only 1 Secondary Site Collection administrator I disagree Asad. Browse to site collection URL, click settings (gear icon) > site settings. Under "Users and Permissions" click "Site collection administrators" Description on the page reads "Site Collection Administrators are given full control over all Web sites in the site collection. They may also receive site use confirmation mail. Enter users separated by semicolons." All of our site collections have 4 site collection administrators. I just can't figure out how to do it with Powershell. – Kerb Dec 24 '15 at 22:37
8

If both primary and secondary owners are set, the only other way to add additional Site Collection admins is to use the New-SPUser command and include the switch parameter -SiteCollectionAdmin.

New-SPUser -UserAlias 'Contoso\Jdow' -DisplayName 'Jane Dow' -Web 'http://contoso.com' -SiteCOllectionAdmin
2

If you need more than two Site Collection admins for every Site Collection in a Web App, try the following.

    $webApp = Get-SPWebApplication "http://mysite.sharepoint.com"

    Foreach($site in $webApp.Sites)
    {
      New-SPUser -UserAlias "domain\user" -DisplayName "User Name" -Web $site.URL
      $usr = Get-SPUser "domain\user" -Web $site.URL
      $usr.IsSiteAdmin = $true
      $usr.Update()
     }

Eric's example worked in my Dev environment, but not my Test environment. The example I provided works in both.

The example could be cleaned up to validate the user and validate if they are already a site admin.

-1

This would be easiest way with existing user for SharePoint Online:

$sites = gc sites.txt
foreach($site in $sites){set-spouser -Site $site -LoginName user@domain.com -IsSiteCollectionAdmin $true}

This would be easiest way with existing user for SharePoint On-prem:

$sites = gc sites.txt
foreach($site in $sites)
{
   set-spuser -Web $site -Identity 'domain\alias' -IsSiteCollectionAdmin $true
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.