A SharePoint 2010 Managed Account, is essentially a Service Account whose credentials are managed by SharePoint, which can automatically change the password of the account based on a given policy / schedule. Check out the posting “Managed Accounts” in Bill Baer’s Blog for more detailed information.

While most of the configuration of managed accounts will likely take place in Central Administration, at some point you may need (or simply prefer) to change the password via PowerShell. Personally, I ran into the need, as my farm account password had been changed and the Central Administration site would not run.

I used the following PowerShell script to change the Managed Account password.

$ver = $host | select versionif ($ver.Version.Major -gt 1)  {$Host.Runspace.ThreadOptions = ReuseThread"}Add-PsSnapin Microsoft.SharePoint.PowerShellSet-location $home

$inManagedAcct = Read-Host 'Service Account'

$managedAcct = Get-SPManagedAccount $inManagedAcct

$inPass = Read-Host 'Enter Password' -AsSecureString$inPassConfirm = Read-Host'Confirm Password' -AsSecureString

Set-SPManagedAccount -Identity $managedAcct -NewPassword $inPass -ConfirmPassword $inPassConfirm -SetNewPassword

Click here to download the PS1 file. You may need to remove the first few lines that load the SharePoint PowerShell snap-in, if you intend to run the script from the “SharePoint 2010 Management Shell” console.