使用Powershell的应用程序池标识预定义/可配置开关

时间:2013-06-26 11:51:00

标签: powershell iis-6 windows-server-2003 application-pool

我正在编写PowerShell脚本,以便在IIS 6(Windows Server 2003 R2)上的应用程序池中的标识设置上设置用户名和密码。出于这个目的,我正在使用来自here的vbscript。但在运行脚本后,我仍然需要手动将“身份”从“预定义”切换到“可配置”。有没有办法通过powershell脚本选择“可配置”?

enter image description here

1 个答案:

答案 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