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

Sign up for an Office 365 SharePoint Online Business Subscription


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


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.


You May Also like the Following SharePoint Online Tutorials:

About Sravan kumar

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

View all posts by Sravan kumar →