0

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? – Amal Hashim Jul 20 '16 at 20:57
  • Yes. It is the default one that got created with the installation. I have not created another instance of it. – Roby Skariah Jul 20 '16 at 21:00
0

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
$procId.Update()

http://tharindupg.blogspot.com/

  • Thanks Waqas... That worked like a charm. Do you think if it works the same for all service applications. – Roby Skariah Jul 20 '16 at 22:03
0

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 
         $pi.Update() 
         $pi.Deploy() 
    } 
}
  • 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> – Roby Skariah Jul 20 '16 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 ? – Amal Hashim Jul 20 '16 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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