I have about 10 service accounts for SharePoint 2013. Is there a good PowerShell script that I can use to change the password for all of these accounts? I have seen this http://www.mstechbits.com/sharepoint-2013/how-to-change-service-account-password-in-sharepoint-2013/ but this is manual and there is no way to do this efficiently for 20 SharePoint servers (prod, test, dev and QC).

  • are those managed accounts?
    – Waqas Sarwar MVP
    Commented May 4, 2016 at 18:26

1 Answer 1


You can try the below mentioned script on each farm.

$mc = Get-SPManagedAccount
foreach($acc in $mc)
 Set-SPManagedAccount -Identity $acc  -ExistingPassword (ConvertTo-SecureString “pass@word2” -AsPlainText -force) –confirm

But drawback is all accounts will have the same password.check this technet for more options: https://technet.microsoft.com/en-us/library/ff607617.aspx?f=255&MSPPError=-2147217396

Another way is to schedule automatic password change at central admin.

  • I am okay with the same password. will it change the password in Active Directory? Commented May 4, 2016 at 18:33
  • it will not, it will only update the SharePoint with password.
    – Waqas Sarwar MVP
    Commented May 4, 2016 at 18:34
  • for that try to use -AutoGeneratePassword true also check this option SetNewPassword
    – Waqas Sarwar MVP
    Commented May 4, 2016 at 18:35
  • Note that -AutoGeneratePassword will only work if the account does not have 'never expire password' and 'user cannot change password' set.
    – user6024
    Commented May 4, 2016 at 18:38
  • 1
    This code works. Thanks all for the support and ideas. $cPassword= ConvertTo-SecureString -String 'Summer@2016' -AsPlainText -Force $nPassword= ConvertTo-SecureString -String 'Winter@2016' -AsPlainText -Force Set-ADAccountPassword -Identity testacct11 -OldPassword $cPassword -NewPassword $nPassword Commented May 4, 2016 at 19:22

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.