Object not found when running the
command “set-spserviceapplicationpool” for web application
Issue: Object not found error when running the command set-spserviceapplicationpool
for web application
Cause: using the Set-SPServiceApplicationPool command we
cannot change the application pool identity of a web application. The command
only works to change the application pool identity for the service application
in SharePoint.
Resolution: Follow the below power shell to change the identity of
the Web Application pool
$ManagedAccount = Get-SPManagedAccount -Identity "domain\username"
$WebApplication.ApplicationPool.ManagedAccount = $ManagedAccount
$WebApplicaiton.ApplicationPool.Update();
$WebApplication.Update()