2013-06-26 25 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 
相關問題