2013-01-09 57 views
7

我需要一個PowerShell命令,做添加IIS中的網站相當,但需要在「應用程序池」的綁定在IIS網站的應用程序池:設置使用PowerShell

enter image description here

到目前爲止我可以添加一個網站這樣做:

New-Item iis:\Sites\swmarket -bindings @{protocol="http";bindingInformation="80:swmarket"} -physicalPath c:\inetpub\wwwroot 

但我不知道如何設置新的網站中的「應用程序池」。任何方式看到所有的綁定?

+2

,試試這個:HTTP://的TechNet。 microsoft.com/en-us/library/ee807831.aspx – D3vtr0n

回答

8
Set-ItemProperty iis:\Sites\swmarket -Name applicationpool -Value swmarket 

另外,使用PowerShell 3,你可以這樣做:如果你有PowerShell的3

New-WebAppPool -Name $WebSiteName 
New-Website -Name $WebSiteName -ApplicationPool $WebSiteName -HostHeader $WebSiteName -PhysicalPath $PathInfo -Port 80 
Set-Content $PathInfo\default.htm 「PSCreated Default Page」 

退房的MS的Technet描述here.

+2

非常感謝。 –