PowerShell script for changing the identity of application pools of my sharepoint server's IIS server.Am having a lot of appln pools and sites. so i think, I can write a PowerShell script and change the identity of old to new one
Set-SpServiceApplicationPool is for the service app pool not for the web application.
to change for web application, please test this script.
$WebApplicaiton = Get-SPWebApplication https://servername:port
$ManagedAccount = Get-SPManagedAccount -Identity "domain\username"
$WebApplication.ApplicationPool.ManagedAccount = $ManagedAccount
If you dont want using the powershell then you can use central admin and change it. By going to
Central admin > security > configure service accounts. on this page from dropdown you can pick the app pool name and then 2nd dropdown pick the account you want to assign it.
Use the below command:
Set-SPServiceApplicationPool -Identity TestServiceWebApplicationPool -Account testdomain\testuser1
Ensure that its a managed account.
Reference - Set-SPServiceApplicationPool