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

2 Answers 2


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

  • am not able to make this happen for the user profile synchro. serv, appln pool. even after 10 + minutes, its still hanging state,,,
    – samolpp2
    Commented Jan 31, 2017 at 7:00
  • any error ? it usually takes some time Commented Jan 31, 2017 at 7:31
  • Synchro service is troubled child, if you need to change it I would recommend, Backing up rebuilding UPS with new account and then attach UPS DB to keep content. Commented Jan 31, 2017 at 14:43
  • On second thought, try to add the new account as a local admin for the duration of the change maybe it is only that keeps hanging UPS . Commented Jan 31, 2017 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.