Hi @Anonymous ,
Please follow the steps:
- Grant Admin Access to All OneDrive for Business Site Collections.
#Set Runtime Parameters $AdminSiteURL="https://tenant-admin.sharepoint.com" #Global Admin $SiteCollAdmin="name@tenant.onmicrosoft.com" #Connect to SharePoint Online Admin Center Connect-SPOService -Url $AdminSiteURL -credential (Get-Credential) #Get all OneDrive for Business Site collections $OneDriveSites = Get-SPOSite -Template "SPSPERS" -Limit ALL -IncludePersonalSite $True Write-Host -f Yellow "Total Number of OneDrive Sites Found: "$OneDriveSites.count #Add Site Collection Admin to each OneDrive Foreach($Site in $OneDriveSites) { Write-Host -f Yellow "Adding Site Collection Admin to: "$Site.URL Set-SPOUser -Site $Site.Url -LoginName $SiteCollAdmin -IsSiteCollectionAdmin $True } Write-Host "Site Collection Admin Added to All OneDrive Sites Successfully!" -f Green
- Please run the below PowerShell script to get a particular person site collection.
#Set Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" $UserAccount="salaudeen@crescent.com" Try { #Setup Credentials to connect $Cred= Get-Credential #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Get the User $User = $Ctx.web.EnsureUser($UserAccount) $Ctx.Load($User) $Ctx.ExecuteQuery() #Get OneDrive Site URL from User Profile $PeopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Ctx) $UserProfile = $PeopleManager.GetPropertiesFor($User.LoginName) $Ctx.Load($UserProfile) $Ctx.ExecuteQuery() #Get the User Profile Property Write-host $UserProfile.PersonalUrl } Catch { write-host -f Red "Error Getting User Profile Properties!" $_.Exception.Message }
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.