Get Users who is not having My site from the User Profiles in SharePoint using PowerShell Script in SharePoint 2013


Using Powershell Script we can find whether the user is having the MySite Profile in SharePoint. The Script follows below.


New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

cls
if ((Get-PSSnapin “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
}
$site = new-object Microsoft.SharePoint.SPSite(“Site URL”);
$Context = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);
$upAttribute = “SPS-PersonalSiteCapabilities”
$PeopleManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($Context)
$profiles = $PeopleManager.GetEnumerator()
Foreach ($User in $profiles)
{
If ($User[$upAttribute].tostring() -ne $null)
{
Write-Host “User who is not having my site:” $User.AccountName -ForegroundColor Green
}
}
write-host “Finished.”
$site.Dispose()

Read some SharePoint PowerShell tutorials:

Hope this article will be helpful.

Check out Best Alternative to InfoPath -> Try Now

FREE SHAREPOINT 2019 PDF

(Installation & Features)



About Sravan kumar

I am a SharePoint Developer Working in Reputed MNC company Bangalore.

View all posts by Sravan kumar →