2013-01-09 54 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

非常感谢。 –