Change site collection administrators for all site collections


In a minute, I will show you how to change the site collection administrators for all site collections using PowerShell. Thanks to Maarten Peeters for helping!

But first, it may be easy to get a result for all the current site collection administators, in case you want to roll back:

Get-SPSite -Limit all | FT Url, Owner, SecondaryContact -AutoWidth

image

Now if you want to change all site collection administrators and secondary site collection administrators (As you would set in Central Administration)

Get-SPSite -Limit All | %{Set-SPSite $_ -OwnerAlias "<domain\user>" -SecondaryOwnerAlias "<domain\user>"}

If you are using MySites and personal sites have been created, you might want to use the following, to exclude the MySite site collections. Please check if you are using the "personal" managed path. If you are using a different managed path, you can change the "*/personal/*" to reflect your environment.

Get-SPSite -Limit All | ?{$_.url -notlike "*/personal/*"} | %{Set-SPSite $_ -OwnerAlias "<domain\user>" -SecondaryOwnerAlias "<domain\user>"}

I hope this helps someone out there to save some valuable time!

About these ads

One Response to Change site collection administrators for all site collections

  1. Tristan says:

    thanks for sharing.
    may i know is it possible for us to change the SharePoint site primary owner to another person, for a given primary site owner?
    forgot to mention, in case of the primary site owner have more than 100 SharePoint sites which the ownership needs to be transferred to another person.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: