Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.