Replace a managed account in SharePoint

Rating:        Based on 1 rating
Reviewed:  1 review
Downloads: 474
Released: Jul 24, 2012
Updated: Aug 9, 2012 by afarag
Dev status: Stable Help Icon

Recommended Download

Source Code ReplaceFarmCredentials
source code, 10K, uploaded Jul 25, 2012 - 474 downloads

Release Notes


Use this powershell script if you would like to replace an existing managed account credential with new managed account. That applies also to the farm admin user. The PowerShell script will scan the following items and replace user account accordingly:
  • 1- SharePoint Services
  • 2- SharePoint Service Applications App Pools
  • 3- SharePoint Web application App Pools

and there is an extra function added "UpdateFarmCredentials" to update the farm credentials if the need be.

I would recommend resetting the IIS after running this script.

How to use the script

You need to run this script in an elevated command prompt screen from one of the SharePoint servers of the targeted farm running with the farm admin account.

At the end of the file make sure you replace the following variables with your desired values:
  • 1- $OldUser (The old managed account you want to replace)
  • 2- $NewUser (The new managed account you want to register and use)
  • 3- $NewUserPassword (The new managed account password)

Please note

  • The script might throw some warnings when you try to use a local account in a farm deployment. You can ignore these warning however, you should know that its not recommended to use local accounts. You might also see some errors regarding deploying some of the changes to some of the Service applications. You can ignore these errors as well.
  • The script will register the new managed account for you if its not registered yet and will prompt you for the password to be stored in SharePoint.
  • This script is written and test on SharePoint 2010 version only.
  • Some users reported that the UPA stopped working after replacing the credentials.

Run this script at your own risk

Reviews for this release

by thomkortekaas on Oct 14, 2015 at 12:30 PM