is there an example of setting the Identity in IIS for a Custom User in an Application Pool using command line or powershell script?
Asked
Active
Viewed 865 times
2 Answers
0
Should be able to do something like this:
Set-ItemProperty -Path "IIS:\AppPools\$AppPoolName" -Name processModel -Value @{userName=$AppPoolUser;password=$AppPoolUserPw;identitytype=3}
See documentation for processModel
here: https://learn.microsoft.com/en-us/iis/configuration/system.applicationHost/applicationPools/add/processModel#configuration

dxking
- 1
- 2
0
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
3.Then enter the appcmd.exe command line, you need to replace the content in the red box.
4.Then you can see that the application pool identity is successfully set as a custom account.
Hope my answer can help you!

YurongDai
- 1,362
- 1
- 2
- 7