...
msoidcli_64 (The Microsoft Online Services Sign-In Assistant)
The Script:
The following Powershell Script will prompt for the user to log in, retrieves all the admins and inserts them into a collection.
Note |
---|
Replace theRED boldbold 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") |
...