Created
July 20, 2018 17:26
-
-
Save ssougnez/7ce39b725602ff281beffac6d032c3fc to your computer and use it in GitHub Desktop.
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
Function CreateWebSite { | |
Param([string]$hostname, [string]$port, [string]$destination) | |
Begin { | |
Push-Location | |
} | |
Process { | |
$name = GetSiteName $hostname $port | |
Set-Location "IIS:\Sites\" | |
if ((Test-Path $name -PathType container) -eq $true) { | |
Warning "The IIS site already exists." | |
} | |
else { | |
$site = New-Item $name -bindings @{protocol = "http"; bindingInformation = $(":{0}:" -f $port) + $hostname} -PhysicalPath $destination | |
$site | Set-ItemProperty -Name "applicationPool" -Value $hostname | |
Success | |
} | |
} | |
End { | |
Pop-Location | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment