IISChangeIP.vbs – Mass IP Address Change and Configuration Tool For IIS

I was recently tasked with changing the IP address for the host headers of an IIS 5 machine. This is a pretty common task as machines are physically relocated; sites are moved from IP to IP address or network to network.

Although this task is simplistic and pretty straight forward to do through the IIS Manager, this particular machine was unique in that it has 1943 host headers associated with nearly as many websites. Yes that is almost two thousand websites on one IIS machine on just 1 IP address. If I were to manually configure each header for the new IP address, and each host header took me 20 seconds to change, it would take me 38,860 seconds or 10.8 hours to change this one IP binding on this particular machine. More than 1½ days work just to configure one setting!

Since this was totally out of the question I decided to write a script (you’re shocked, I know) to handle this task for you instead. I have packaged this nicely for your IIS configuring pleasure.

This particular script works only with cscript.exe. This is the command line version of wscript.exe that I’m sure you’re probably familiar with if you’re reading this site. To use the script you can simply pass the IP address you’d like to change, and then the new IP address you’d like to change to. If you’d simply like to “unbind” the IP address so that the host headers use “All Unassigned” simply pass the keyword “unbound” in the place of an IP address.

I have borrowed some functions that I used in some previous scripts, one called IsIP, which simply verifies that the IP address you passed is a potentially valid IP, and CheckInterpreter which checks to see which VBScript interpreter you are using to execute the script with, since this script won’t work if you simply double click on it.

As always please feel free to respond with any questions or comments you might have.

 

2 thoughts on “IISChangeIP.vbs – Mass IP Address Change and Configuration Tool For IIS

Leave a Comment