Summary
I want to find out the User’s OneDrive for Business url or personal site. I also want to find more such user properties for the user with UPN, such as when the personal site created, if not created what is the state of the personal site etc. You will find all this information here.
Step By Step Solution
It is very simple to do but before you run the PnP.PowerShell command make sure you follow prerequisite for connecting to the new tenant. This is a good article.
In short, you need to call Register-PnPManagementShellAccess and accept the consent. This will create the Azure AD app Service Principal in your tenant.
After that you can call the following scripts to get all User’s OneDrive URL.
Connect-PnPOnline -url https://gov963094-admin.sharepoint.com/
$p = Get-PnPUserProfileProperty -Account 'admin@GOV963094.onmicrosoft.com'
$p.PersonalUrl
### OUT PUT is ###
### https://gov963094-my.sharepoint.com/personal/admin_gov963094_onmicrosoft_com/
$p.UserProfileProperties
### OUTPUT of above will provide all the properties.
If you notice there are properties for the Personal Site with information such as what and when the personal sites were created or enqueued.
Property-Name |
AboutMe |
AccountName |
ADGuid |
Assistant |
CellPhone |
DelveFlags |
Department |
Fax |
FirstName |
HomePhone |
LastName |
Manager |
msOnline-ObjectId |
Office |
OfficeGraphEnabled |
PersonalSpace |
PictureURL |
PreferredName |
PublicSiteRedirect |
PulseMRUPeople |
QuickLinks |
SID |
SPS-AdjustHijriDays |
SPS-AltCalendarType |
SPS-Birthday |
SPS-CalendarType |
SPS-ClaimID |
SPS-ClaimProviderID |
SPS-ClaimProviderType |
SPS-ContentLanguages |
SPS-DataSource |
SPS-Department |
SPS-DisplayOrder |
SPS-DistinguishedName |
SPS-DontSuggestList |
SPS-Dotted-line |
SPS-EmailOptin |
SPS-FeedIdentifier |
SPS-FirstDayOfWeek |
SPS-FirstWeekOfYear |
SPS-HashTags |
SPS-HideFromAddressLists |
SPS-HireDate |
SPS-Interests |
SPS-JobTitle |
SPS-LastColleagueAdded |
SPS-LastKeywordAdded |
SPS-Locale |
SPS-Location |
SPS-MasterAccountName |
SPS-MemberOf |
SPS-MUILanguages |
SPS-MultiGeoFlags |
SPS-MySiteUpgrade |
SPS-O15FirstRunExperience |
SPS-ObjectExists |
SPS-OWAUrl |
SPS-PastProjects |
SPS-Peers |
SPS-PersonalSiteCapabilities |
SPS-PersonalSiteFirstCreationError |
SPS-PersonalSiteFirstCreationTime |
SPS-PersonalSiteInstantiationState |
SPS-PersonalSiteLastCreationTime |
SPS-PersonalSiteNumberOfRetries |
SPS-PhoneticDisplayName |
SPS-PhoneticFirstName |
SPS-PhoneticLastName |
SPS-PictureExchangeSyncState |
SPS-PicturePlaceholderState |
SPS-PictureTimestamp |
SPS-PointPublishingUrl |
SPS-PrivacyActivity |
SPS-PrivacyPeople |
SPS-ProxyAddresses |
SPS-RecipientTypeDetails |
SPS-RefreshToken |
SPS-RegionalSettings-FollowWeb |
SPS-RegionalSettings-Initialized |
SPS-ResourceAccountName |
SPS-ResourceSID |
SPS-Responsibility |
SPS-SavedAccountName |
SPS-SavedSID |
SPS-School |
SPS-SharePointHomeExperienceState |
SPS-ShowWeeks |
SPS-SipAddress |
SPS-Skills |
SPS-SourceObjectDN |
SPS-StatusNotes |
SPS-TenantInstanceId |
SPS-Time24 |
SPS-TimeZone |
SPS-UserPrincipalName |
SPS-UserType |
SPS-WorkDayEndHour |
SPS-WorkDays |
SPS-WorkDayStartHour |
Title |
UserName |
UserProfile_GUID |
VideoUserPopup |
WebSite |
WorkEmail |
WorkPhone |
Conclusion
It is pretty simple to get all these information for the user profile using PnP.PowerShell.