This blog contains sample code. As a standard disclaimer, please note that any sample code is provided “as is” without any explicit or implied warranties and the sole responsibility of any consequences arising from the “use” (in the broadest possible sense) of any code, suggestion, or idea is entirely upon the applicant.
Having said that, here is some PowerShell code that can easily and rapidly change the IIS application pool service accounts. Under UAC, use admin prompt for PowerShell. You need to have the WebAdministration module installed.



Import-Module WebAdministration
$domainUser = "domain\user" # modify as per your credentials
$secureDomainPwd = Read-Host -Prompt "Enter Password for $domainUser" -AsSecureString
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureDomainPwd )
$domainPwd = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$applicationPools = Get-ChildItem IIS:\AppPools | where { $_.processModel.userName -eq "$domainUser" }
foreach($pool in $applicationPools)
{
    $pool.processmodel.username = $domainUser
    $pool.processmodel.password = $domainPwd
    $pool.processmodel.identitytype = 3
    $pool | set-item
    if ($pool.state -eq 'Started')
    {
        $pool.Stop();
        $pool.Start();
    }
}