How to fix farm service account password out of sync in SharePoint 2010?

Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LT | LV | NL | NO | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZH-TW

If you get farm service account password out of sync you properly know your way around SharePoint 2010 pretty well so this article just go right into the exact what to do to sync up your servers in the farm.

Here are things that you do to sync up your SharePoint farm service account password.

. Run GetManagedAccountPasswords.ps1 (see file below) to get a list of password from SecurityTokenServiceApplicationPool.
. Make sure all IIS Application Pools and Services that use farm service account has the right password, change it if you must.
. Run this "Set-SPManagedAccount -UseExistingPassword -Identity DOMAINA\SPSAdmin" to set the password on each SharePoint server in the farm.
. Run "Repair-SPManagedAccountDeployment" at the main server of the farm to verify the passwords are now in sync with no error.
. Run IISRESET command.

Your farm service account password should now in sync!

# file: GetManagedAccountPasswords.ps1
# instruction: run this to get a list of password on each SharePoint server
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0;
function Bindings(){
return [System.Reflection.BindingFlags]::CreateInstance -bor
[System.Reflection.BindingFlags]::GetField -bor
[System.Reflection.BindingFlags]::Instance -bor
[System.Reflection.BindingFlags]::NonPublic;
}
function GetFieldValue([object]$o, [string]$fieldName){
$bindings = Bindings;
return $o.GetType().GetField($fieldName, $bindings).GetValue($o);
}
function ConvertTo-UnsecureString([System.Security.SecureString]$string){
$intptr = [System.IntPtr]::Zero;
$unmanagedString = [System.Runtime.InteropServices.Marshal]::SecureStringToGlobalAllocUnicode($string);
$unsecureString = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($unmanagedString);
[System.Runtime.InteropServices.Marshal]::ZeroFreeGlobalAllocUnicode($unmanagedString);
return $unsecureString;
}
Get-SPManagedAccount | select UserName, @{Name='Password'; Expression={ConvertTo-UnsecureString (GetFieldValue $_ 'm_Password').SecureStringValue}}