With this powershell script you will be able to change the user name and password of any application pool in which the user equals to a specific one. This is meaning that it will replace the existing credentials with new ones (in all the application pools)
- The ps1 file should be executed elevated. If not the change method will fail.
- You can change the user name and password of any application pool that has a specific user.
- It can run only in the running server.
All parameters are mandatory. If you don’t provide them, powershell will ask.
- OLDUser: This would be the old user name. The script will filter all the application pools matching this User and will replace it with the NewUser parameter
- NewUser: this is the user name that the application pool will use.
- NewPassword: password of the NewUser
- AppCmdToolLocation: Location of the appcmd command. By default is located in c:\windows\system32\inetsrv\appcmd.exe.
.\changeUserAppPool.ps1 –OldName .\OLDAdmin –NewUser .\NewAdmin –NewPassword NewPassword –appCmdToolLocation c:\windows\system32\inetsrv\appcmd.exe
Download the Code
You can download the code here, at MSDN Code Gallery.