Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a website's application pool in IIS using Powershell

I need a Powershell command that does the equivalent of adding a website in IIS, but need the bindings for the "Application pool":

enter image description here

So far I can add a website doing this:

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

But I don't know how to set the "Application pool" in the new website. Any way to see all the bindings?

like image 915
Kasper Hansen Avatar asked Jan 09 '13 15:01

Kasper Hansen


People also ask

How do I select an application pool in IIS?

Open Internet Information Service Manager. Expand the IIS server. Choose Application Pool. On the right pane, click Add Application Pool or right-click the middle pane and choose Add Application Pool.

How do you put an application pool on an application?

In the Connections pane, expand the server name, and then click Application Pools. In the Actions pane, click Set Application Pool Defaults... On the Application Pool Defaults dialog box, specify your desired options. When you have finished specifying your settings, click OK.


1 Answers

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

Alternatively, with Powershell 3, you could 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 the MS Technet description here.

like image 190
D3vtr0n Avatar answered Sep 19 '22 13:09

D3vtr0n