我正在编写PowerShell脚本,以便在IIS 6(Windows Server 2003 R2)上的应用程序池中的标识设置上设置用户名和密码。出于这个目的,我正在使用来自here的vbscript。但在运行脚本后,我仍然需要手动将“身份”从“预定义”切换到“可配置”。有没有办法通过powershell脚本选择“可配置”?
答案 0 :(得分:3)
找到解决方案。以下PowerShell代码解决了该问题。
#Assigning Identity's Username To AppPool
cscript adsutil.vbs SET w3svc/AppPools/YourAppPoolName/WAMUserName Username
#Assigning Identity's Password To AppPool
cscript adsutil.vbs SET w3svc/AppPools/YourAppPoolName/WAMUserPass Password
#Making ApplicationPool Configurable
cscript adsutil.vbs SET w3svc/AppPools/YourAppPoolName/AppPoolIdentityType 3