Wednesday, February 4, 2009

Release Renew IP Addresses

Here is a nice little script to get all workstations that were leasing from 1 DHCP server to release and renew addresses to a 2nd Microsoft DHCP server.

psexec.exe -cd -n 2 @ipaddresses.txt release.bat

The -c copies the bat file to the workstation.  The -d doesn't wait for each line to finish (without it, your connection will get lost after the first line, ipconfig /release).  The -n 2 changes the timeout behavior to assume that all workstations will respond within 2 seconds.

release.bat has only 2 lines:
ipconfig /release
ipconfig /renew

The ipaddresses.txt file has a list of all IP addresses from the original DHCP scope.  If it finds a workstation on the 'old' ip range, then it will force the workstation to give up the address and ask for a new one.

1 comment:

  1. Thanks for the post....Yes,I was able to change my Public IP through your tips.I confirmed the change in IP through Ip-details.com

    ReplyDelete