powershelliisapplication-poolapplicationpoolidentity

Setup IIS Identity in an ApplicationPool using cmd or ps1


is there an example of setting the Identity in IIS for a Custom User in an Application Pool using command line or powershell script?


Solution

  • You can use the following appcmd.exe command line to set an identity in IIS for a custom user in the applicationpool.

    appcmd.exe set config /section:applicationPools /[name='APP_POOL_NAME'].processModel.identityType:SpecificUser /[name='APP_POOL_NAME'].processModel.userName:DOMAIN\USER_NAME /[name='APP_POOL_NAME'].processModel.password:PASSWORD 
    

    Here is my test steps and result:

    1.Run cmd as administrator

    2.Change directory to the location where appcmd.exe resides (c:\windows\system32\inetsrv):

    cd %WINDIR%\system32\inetsrv

    image1

    3.Then enter the appcmd.exe command line, you need to replace the content in the red box. image2

    4.Then you can see that the application pool identity is successfully set as a custom account. image3

    Hope my answer can help you!