Does anyone know of a Powershell script that can be used to pull user profile information from SharePoint Online 2013? The SharePoint server scripts are useless.

Particularly, we are looking for a script that will tell us if a user has a MySite/SkyDrive/OneDrive personal site

2 Answers 2


The following script allows you to access user profile properties for Sharepoint Online users.
Under PersonalSpace you can find either a link or an empty field. It will let you know if the user has the personal site.

Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Context.Credentials = $Creds

#Identify users in the Site Collection
$Users = $Context.Web.SiteUsers

#Create People Manager object to retrieve profile data
$PeopleManager = New-Object   Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Context)
Foreach ($User in $Users)
$UserProfile = $PeopleManager.GetPropertiesFor($User.LoginName)
If ($UserProfile.Email -ne $null)
    Write-Host "User:" $User.LoginName -ForegroundColor Green
    Write-Host ""

Actually there is another way, much simpler, that doesn't involve scripting and still shows you which users have personal site.

Connect via SharePoint Management Shell and write in the console: Get-SPOUser -Site https://domain-my.sharepoint.com

You will get a list of list of users (+some extras) who created their personal site.

  • Is there a way to get this information using the REST API? Jan 4, 2016 at 12:13

I am working on a script that does this right now. Check out this example script, which uses the user profile service proxy to iterate through users. The script checks if($Url). If this value is true, the user has a provisioned OneDrive site.

  • Please post the relevant code directly in your answer, not by linking to an external site. Jan 11, 2018 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.