Who's Online
13 visitors online now
4 guests, 9 bots, 0 members
Support my Sponsor
  • An error has occurred, which probably means the feed is down. Try again later.

PowerShell to Add a user as admin on all site collections in SharePoint online

Also explained in my Youtube Video : https://youtu.be/icx_m15UIMg

You can modify this script to add these users as a member of visitor to all Site collections.

Connect to SharePoint Online

Connect-SPOService -Url https://contoso-admin.sharepoint.com

Get all site collections

$siteCollections = Get-SPOSite -Limit All

Loop through each site collection and add the user as an admin

foreach ($siteCollection in $siteCollections) {
Set-SPOUser -Site $siteCollection.Url -LoginName “[email protected]” -IsSiteCollectionAdmin $true
}

Comments are closed.