Tuesday, December 22, 2015

Update User Profile Properties in SharePoint using PowerShell

SharePoint User Profile properties are usually imported from Active Directory to provide information about SharePoint users. At times, we may have to update SharePoint user profiles manually. My scenario is to update user profile pictures from a SharePoint library. Here is my PowerShell script:

PowerShell Script to update User Profile Property:

#Configuration Variables
$MySiteURL = "https://Mysite.Crescent.com"

#Get User Profile Objects
$ServiceContext  = Get-SPServiceContext -site $MySiteURL
$UserProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)

#Check if user Exists
if ($UserProfileManager.UserExists($UserLogin)) 
    #Get the User Profile
    $UserProfile = $UserProfileManager.GetUserProfile($UserLogin)

    #Update user profile picture Property
    $userProfile["PictureURL"].Value = "https://intranet.Crescent.com/UserProfileImages/Salaudeen.jpg"
    write-host "User Picture Updated Successfully!" -f Green
    write-host "$($UserLogin) Not Found!" -f Red
Make sure to remove mapping between SharePoint user profile property and Active Directory under User profile service application's "Manage User Properties" page. If there is a mapping defined, when next time user profile sync runs, your updates will be overwritten!
sharepoint 2010 update user profile properties powershell
Once updated, Run incremental/full search crawl for the updates to reflect in SharePoint search!

Tags: update user profile properties sharepoint 2013 powershell, update user profile property sharepoint, edit user profile property sharepoint 2013, edit user profile property sharepoint 2013 powershell, sharepoint 2013 update user profile property powershell

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...