0

I need to update a property for a user in SharePoint User Profile Service but cannot to do this through the UI in Central Admin. So I want to perform the update using Powershell and the userprofileservice.asmx web service. The advantage of using a script is that it can be applied in different environments and also provides traceability on what has been changed.

Is it possible to call this web service from Powershell?

I'm running on-prem SharePoint 2013 with Nov 2014 CU.

1

1 Answer 1

0

The code below update the HomePhone property for a user identified by $account

$upws = New-WebServiceProxy "http://<<server>>/_vti_bin/userprofileservice.asmx" -UseDefaultCredential
$account = '<<domain>>\<<username>>'

$userProperty = $upws.GetUserPropertyByAccountName($account,'HomePhone')
Write-Output "Value before update: " $userProperty.Values[0].Value

$userProperty.Values[0].Value = "555-123-456"
$userProperty.IsValueChanged = $true
Write-Output "Updating with value: " $userProperty.Values[0].Value

$upws.ModifyUserPropertyByAccountName($account,$userProperty)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.