Created
August 22, 2012 12:51
-
-
Save NickJosevski/3425309 to your computer and use it in GitHub Desktop.
Multiple IIS site creation, via PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host "Remember to run in an x86 Powershell" | |
Import-Module WebAdministration | |
$start_dir = Get-Location | |
CD IIS:\ | |
New-Item AppPools\test.pool | |
Set-ItemProperty IIS:\AppPools\test.pool -name "enable32BitAppOnWin64" -Value "true" | |
Set-ItemProperty IIS:\AppPools\test.pool -name "managedRuntimeVersion" -Value "v4.0" | |
$sitesToCreate = 2 | |
$path = "C:\dev\project-x\App.Web" | |
$appPool = "test.pool" | |
while ($sitesToCreate -gt 0) | |
{ | |
$siteName = "s" + $sitesToCreate + ".site.local" | |
$siteWithIISPrefix = "IIS:\Sites\" + $siteName | |
Write-Host "Creating: " $siteName | |
$site = New-Item $siteWithIISPrefix -bindings @{protocol="http";bindingInformation="*:80:" + $siteName } -physicalPath $path | |
Set-ItemProperty IIS:\Sites\$siteName -name applicationPool -value $appPool | |
$sitesToCreate-- | |
} | |
Write-Host "done" | |
CD $start_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment