Using Powershell 1.0 under Windows Server 2003 with IIS 6.
I have about 200 sites that I would like to change the IP address for (as listed in the website properties on the "website" tab in the "Web site identification" section "IP address" field.
I found this code:
$site = [adsi]"IIS://localhost/w3svc/$siteid"
$site.ServerBindings.Insert($site.ServerBindings.Count, ":80:$hostheader")
$site.SetInfo()
How can I do something like this but:
- Loop through all the sites in IIS
- Not insert a host header value, but change an existing one.
The following PowerShell script should help: