Script:
$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")
#Must be SharePoint Administrator URL
$webUrl = "https://tenant-admin.sharepoint.com"
$username = "admin@tenant.onmicrosoft.com"
$password = "password"
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-SPOService -Url $webUrl -Credential $cred
$site = Get-SPOSite -Identity https://tenant-my.sharepoint.com/personal/mysites_domain_com
Set-SPOUser -Site $site.Url -LoginName username@email.com -IsSiteCollectionAdmin $true
No comments:
Post a Comment