Script to add global SP admin to all site collections

Brass Contributor

In this thread a script was posted to add a admin user as site owner to each sharepoint online (and office group) site.


One key component of this scirpt is the line 


$SPOnlineAdminClaim = "c:0-.f|rolemanager|s-1-5-21-XXXXXXXXXX-XXXXXXXXX-XXXXXXXXXX-XXXXXXXXX"


to 'create' a admin credential. How is that variable created? Where does this SID (?) comes from? I am global sharepoint online admin and I want to use this script. I tried to use my SID that came from 


get-aduser -Identity "sharepointadminX" |  Select-Object -Property SID

and put that SID after 



but with no luck. 


When I tried 

Set-SPOUser -Site "" -LoginName "c:0-.f|rolemanager|S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxx" -IsSiteCollectionAdmin $true

I got the error 'user not existing (raised by: Set-SPOUser)'


How do I get this script working?



1 Reply