Friday, January 8, 2021

change the user profile property value for all users via PowerShell?

 Add-PSSnapin Microsoft.SharePoint.PowerShell


$site=Get-SPSite "https://site.drizzleinfotech.in"

$serviceContext = Get-SPServiceContext $site;            


$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext);            

$userProfile = $upm.GetUserProfile("raghur@drizzleinfotech.in");


foreach($userProfile in $upm)

{

  $userProfile["PropertyName"].Value = "Test Value";   

  $userProfile.Commit()

}

No comments:

Post a Comment