I am trying to change the manged accounts for SharePoint 2013 service applications. Here is how I am using my powershell scripts

 $svc = Get-SPServiceInstance -Server DEVSP01 | where {$_.Name -eq "Search Service Application"}
 $svc.Service.ProcessIdentity.Username = "Domain\ManagedAccountusername"

I am constantly getting error executing the power-shell script.

The property 'Username' cannot be found on this object. Verify that the property exists and can be set. At line:1 char:1 + $svc.Service.ProcessIdentity.Username = "Domain\ManagedAccountusername"

I have also tried

$svc.Service.ProcessIdentity.ManagedAccount = <Domain\ManagedAccountusername>

Any help would be appreciated.

  • Are you sure the service application name is Search Service Application? Jul 20, 2016 at 20:57
  • Yes. It is the default one that got created with the installation. I have not created another instance of it. Jul 20, 2016 at 21:00

2 Answers 2


If account is registered in managed account then try this for search service application

$MgtAccount = Get-SpManagedAccount -Identity "Domain\ManagedAccountusername"
$procId = (Get-SPEnterpriseSearchService).get_ProcessIdentity()
$procId.CurrentIdentityType = "SpecificUser"
$procId.ManagedAccount = $MgtAccount


  • Thanks Waqas... That worked like a charm. Do you think if it works the same for all service applications. Jul 20, 2016 at 22:03

Try modifying your code as below

$svc = Get-SPServiceInstance -Server DEVSP01 | where {$_.TypeName -eq "Search Service Application"}
Set-ServiceIdentity $svc "Domain\ManagedAccountusername"
function Set-ServiceIdentity($svc, $username) 
    $pi = $svc.Service.ProcessIdentity 
    if ($pi.Username-ne $username) { 
         $pi.Username= $username 
  • Thanks Amal. It just didn't help me though. Isn't it the same piece of code in a bit more conditioned way? Its not recognizing the function. Set-ServiceIdentity : The term 'Set-ServiceIdentity' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At <path\ps1> Jul 20, 2016 at 21:19
  • No if you check the where clause I am using TypeName instead of Name.. Have you tried outputting $svc object and made sure its actually loaded ? Jul 20, 2016 at 21:20

Your Answer

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

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