Modifying Site Collection Properties with PowerShell

Administrators can use PowerShell to easily modify all the properties of any PowerShell object.

Let’s consider the following scenario. An administrator needs to add user CompanyABC.com\John as a secondary administrator for all site collections. This is an ideal example of how PowerShell can help to automate SharePoint administration. To achieve the goal, type the following command:

Get-SPSite | Set-SPSite –SecondaryOwnerAlias "CompanyABC.com\John"

In the preceding example, we use Get-SPSite to get the list of all the site collections and then combine that with the Set-SPSite cmdlet that sets a Secondary Owner value to “CompanyABC.com\John”.

To verify that the cmdlet completed successfully, ...

Get Microsoft SharePoint 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.