Powershell set -secondaryowneralias in SharePoint Online?

Copper Contributor

Need to add secondary site collection admins to all sites via poweshell command.  

 

Various older posts I've found say that the old -secondaryowneralias doesn't work in Online.

 

Is there any new progress on this?

2 Replies
$Sites = Get-SPOSite
Foreach ($Site in $Sites)
{
Write-host "Adding Site Collection Admin for:"$Site.URL
Set-SPOUser -site $SiteCollURL -LoginName $SiteCollectionAdmin -IsSiteCollectionAdmin $True
}


Read more: http://www.sharepointdiary.com/2015/08/sharepoint-online-add-site-collection-administrator-using-pow...
Peter's code should work like a charm :)