How can I get the name of the Farm account ? I can see it listed in Get-SPManagedAccount, but do not see any properties on the SPManagedAccount objects to be able to dynamically filter by and determine if it's the farm administrator.
(Get-SPFarm).DefaultServiceAccount.Name should give you the Farm Account
This will give you the Farm Administrators:
$ca = [Microsoft.SharePoint.Administration.SPWebService]::AdministrationService.WebApplications | Select -First 1 $root = $ca.Sites["/"].RootWeb $grp = $root.SiteGroups["Farm Administrators"] $grp.Users
Get-SPManagedAccount will give you managed accounts
There should only be the farm admin common in these two groups
Alternatively to PowerShell, SharePoint Timer Service runs under farm account. Check it out and you get farm account
This is what I used to change the farm account
Get-SPManagedAccount New-SPManagedAccount Remove-SPManagedAccount Set-SPManagedAccount
To change the farm account you need to use stsadm, still.
stsadm –o updatefarmcredentials –userlogin DOMAIN\username –password password