Archive for September, 2011
If you need to bulk add IPs to a Windows server (2003 or 2008) one of the following batch scripts will make that much easier.
This example will add a range of IPs as specified between the parentheses. Here are the values used in the example below:
2 = Starting octet
1 = Value to increment
5 = Ending octet
FOR /L %%i IN (2,1,5) DO netsh in ip add address "EXT" 192.168.1.%%i 255.255.255.192
This will add 192.168.1.2 through 192.168.1.5 to the connection labeled “EXT”.
If you have a list of IPs that need to be added in a text file, the following batch script can be used. Ensure that each IP is on a new line:
FOR /F %%i IN (IPs.txt) DO (
netsh in ip add address "EXT" %%i 255.255.255.240
Make sure “IPs.txt” is the name of your file, “EXT” is the name of your connection, and the netmask (255.255.255.240) is correct for your range.