Configuring a website application pool in IIS using Powershell

I need a Powershell command that is equivalent to adding a website to IIS, but you need bindings to bind to the "application pool":

enter image description here

So far I can add a site:

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

But I do not know how to install the "Application Pool" on the new website. Any way to see all the bindings?

+7
source share
1 answer
 Set-ItemProperty iis:\Sites\swmarket -Name applicationpool -Value swmarket 

Alternatively, with Powershell 3, you can do this:

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

Check out MS Technet's description here.

+8
source

All Articles