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.
D3vtr0n
source share