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).


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? May 4 '16 at 18:33
  • it will not, it will only update the SharePoint with password.
    – Waqas Sarwar MVP
    May 4 '16 at 18:34
  • for that try to use -AutoGeneratePassword true also check this option SetNewPassword
    – Waqas Sarwar MVP
    May 4 '16 at 18:35
  • Note that -AutoGeneratePassword will only work if the account does not have 'never expire password' and 'user cannot change password' set. May 4 '16 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 May 4 '16 at 19:22

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.