...
Note |
---|
Replace the RED bold variable value examples below with your site-specific values. |
...
Code Block | ||
---|---|---|
| ||
$objCreds = Get-Credential |
...
$siteAdminUrl = "https://skysyncdesktop-admin.sharepoint.com" |
...
$sitePersonalBaseUrl = "https://skysyncdesktop-my.sharepoint.com/personal/" |
...
$sitePersonalSuffix = "_skysyncdesktop_onmicrosoft_com" |
...
...
Connect-SPOService -Url $siteAdminUrl -credential $objCreds |
...
Connect-MSOLService -credential $objCreds |
...
$objRole = Get-MsolRole -RoleName "Company Administrator" |
...
$colAdmins = Get-MsolRoleMember -RoleObjectId $objRole.ObjectId | Select EmailAddress |
...
$colUsers = Get-MSOLUser -All | Select UserPrincipalName |
...
Write-Host "Users" |
...
...
foreach ($objUser in $colUsers){ |
...
$strUser = $objUser.userprincipalname |
...
$intPos = $strUser.IndexOf("@") |
...
$strUser = $strUser.SubString(0, $intPos) |
...
$strUser = $strUser.replace(".","_") |
...
$strSite = $sitePersonalBaseUrl + $strUser |
...
$strSite = $strSite + $sitePersonalSuffix |
...
...
foreach ($objAdmin in $colAdmins){ |
...
Write-Host $objAdmin.EmailAddress |
...
Write-Host $strSite |
...
Set-SPOUser -Site $strSite -LoginName $objAdmin.EmailAddress -IsSiteCollectionAdmin $true |
...
} |
...
} |
...
Write-Host "Press any key to continue ..." |
...
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") |
Please contact Portal Architects support for assistance with this article.
...