Of all days in the week, on Sunday [August 21, 2011] I decided to tease my SharePoint 2010 development environment! I decided to change all the SharePoint 2010 Service Account(s)password.
Thank you Microsoft for introducing the managed accounts, else I would be clicking away for a long time, having to go through each application pool to change the password (map this scenario to MOSS 2007 or WSSv3). With managed accounts associated with application pools, it was a matter of changing the password for the managed account and it would ‘cascade’ down…
If you have seen my re-imaging VMs on the fly series, you would have seen that I am not using one service account in my SharePoint virtual development environment!
To update the password from the Central Administration GUI > Security > General Security > Configure Managed Accounts and click edit on the relevant managed account and then select Change password now and then select Use existing password. Enter the password that was entered in AD and click OK.
However, in a situation where I had 5 farms and 8 managed accounts per farm, it would mean I would be clicking 40 times at least to get this job done… ( not accounting for the clicks listed in the steps above )
So, I decided to get my hands dirty with PowerShell! Here is the script to use an ‘existing password’ from the active directory (after it has been changed in the ADS) for my managed account that I am using for all my demo web applications
#Set Execution Policy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -force
#Import SharePoint Module
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA silentlycontinue
$m = Get-SPManagedAccount -Identity “sharepoint\sa-spcontent”
Set-SPManagedAccount -Identity $m -ExistingPassword (ConvertTo-SecureString “[email protected]” -AsPlainText -force) –confirm
PowerShell experts, your feedback will be highly appreciated!
This script got the job done, but if there are better ways of doing this, suggestions welcome.