Goal: Update an existing host header for an IIS7.5 site with powershell
Problem: Set-WebBinding
requires the name of t
Modified Shay's answer to support multiple bindings.
Get-WebBinding -HostHeader *.stuff.* | Foreach-Object{
#$NewHeader = $_.bindingInformation -replace '\.stuff\.','.staff.'
Set-WebConfigurationProperty -Filter ($_.ItemXPath + "/bindings/binding[@protocol='http' and @bindingInformation='" + $_.bindingInformation + "']") -PSPath IIS:\ -Name bindingInformation -Value $NewHeader
}