2013-06-26 26 views
1

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

enter image description here

+0

如果您正在编写PowerShell脚本,为什么您的问题标记为“VBScript”?另外,请显示您的代码。 –

+0

因为要设置密码/用户名我使用服务器的vb脚本。并且从powershell启动vbscripts很容易 – kravasb

回答

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 
相关问题