SharePoint 2013 – Delete User Profile PictureURL values from all profiles


SharePoint offers 3 options for User Profile and Property synchronization.

1. SharePoint Profile Synchronization
2. SharePoint Active Directory Import
3. External Identity Manager

I won’t go into the depth of each, but let’s say you choose SharePoint Profile Synchronization to import Active Directory information including the Picture.

Now after syncronization, you need to run this SharePoint Powershell to convert the imported pictures into the small, medium, large sized photos that can be used properly.


Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http://mysitehost:port/sites/people/

Now, it seems maybe not all PictureURL properties got imported and converted, and you have to start again.

Instead of deleting the user profiles (and potential data entered by the user), here is a quick and easy way to clear out the PictureURL property from all user profiles.


Add-PSSnapin Microsoft.Sharepoint.Powershell
$site = Get-SPSite http://mysitehost:port/
$context = Get-SPServiceContext $site
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$upPictureURLAttribute = "PictureURL"
$profiles = $upm.GetEnumerator()
foreach ($userprofile in $profiles)
{
write-host "Deleting ", $userprofile[$upPictureURLAttribute].GetValue()
$userprofile[$upPictureURLAttribute].clear()
$userprofile.commit()
write-host "Deleted"
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s