[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server"); $site=new-object Microsoft.SharePoint.SPSite("https://c05470sp10:7443"); $serviceContext = Get-SPServiceContext $site; $site.Dispose(); $upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext); $userProfile = $upm.GetUserProfile("myarlett@company.com");
[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server"); $site=new-object Microsoft.SharePoint.SPSite("https://c05470sp10:7443"); $serviceContext = Get-SPServiceContext $site; $site.Dispose(); $upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext); $userProfile = $upm.GetUserProfile("company\myarlett");
$userProfile.Properties | sort DisplayName | FT DisplayName,Name,@{Label="Type";Expression={$_.CoreProperty.Type}}
$userProfile["AboutMe"].Value
$userProfile["SPS-Location"].Value = "London"; $userProfile.Commit();
$userProfile["Manager"].Value = (Get-SPWeb https://c05470sp10:7443).EnsureUser("company\fred"); $userProfile.Commit();
$rp = $userProfile["SPS-Responsibility"] #Print out the current values foreach($s in $rp){$s} #Add a new value to the UserProfileValueCollection $rp.Add("Awesomeness"); #Set the SPS-Responsibility property with the UserProfileValueCollection $userProfile["SPS-Responsibility"].Value = $rp; #Save the profile changes back to the User Profile store $userProfile.Commit()
#Delete all values in the UserProfileValueCollection $rp.Clear() #Set the SPS-Responsibility property with the UserProfileValueCollection $userProfile["SPS-Responsibility"].Value = $rp; #Save the profile changes back to the User Profile store $userProfile.Commit()
$userProfile2 = $upm.GetUserProfile("company\matthewette"); $userProfile2["AboutMe"].Value = $userProfile["AboutMe"]; $userProfile2.Commit();
https://gallery.technet.microsoft.com/Export-SharePoint-User-04fbc24d