Mastodon
January 13, 2012

Mass Updating Site Owners

In SharePoint, if you’re smart, you have written a custom footer to display the site owner (or primary site collection administrator) so people know who to talk to when something goes wrong.  They get all of the grief.  What’s more, sometimes those that get all the grief are no longer with the firm.  It could be a pain if that person was listed as such in many many places.  Here’s a simple PowerShell script to alleviate that challenge:

Get-SPWebApplication <app url> | Get-SPSite -limit all | where {$_.Owner.UserLogin -eq ‘domainusername’ } |  %{

$newowner = Get-SPUser ‘domainnewusername’ -web $_.RootWeb

$_.Owner = $newowner

write-host $_.Rootweb

}