다음을 통해 공유


Powershell script to change application pool credentials

 

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)

 

Pre-Requisites:

  1. The ps1 file should be executed elevated. If not the change method will fail.


Functionalities

  • 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.


Parameters

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.

Example:

.\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.

Comments

  • Anonymous
    January 09, 2017
    is there anyway to pick a specific app pool and change the user and password for it?I need to change the applicationpoolidentity to specific user
    • Anonymous
      March 05, 2017
      The comment has been removed