Sep 07 2021 07:40 AM
We would like to include all the sharepoint sub sides via script, in order to site admin permission.
#Variables for processing
$AdminURL = ""
#Connect to SharePoint Online
Connect-SPOService -url $AdminURL -credential (Get-Credential svcAsigra4@partnerscapitalig.onmicrosoft.com)
#Get All Site Collections
$Sites = Get-SPOSite -Limit ALL
#Loop through each site and add site collection admin
Foreach ($Site in $Sites)
{
Write-host "Adding Site Collection Admin for:"$Site.URL
Set-SPOUser -site $Site.Url -LoginName $True
Set-SPOUser -site $Site.Url -LoginName $True
Set-SPOUser -site $Site.Url -LoginName $True
Set-SPOUser -site $Site.Url -LoginName sv $True
}
How this can be modified added the current private channels and sub sites to the script