Scripts

KeepDHCPAddress Service – Keep DHCP address even when DHCP server unavailable

Written in 2008 for the Windows versions of the time. Check that the tool or steps still suit your environment before using them.

KeepDHCPAddress Service by Shaun Vermaak records all DHCP provided addresses so that when DHCP server becomes unavailable it can set those addresses as static addresses... Static addresses are removed when DHCP server becomes available again

Publishers website: https://www.ittelligence.com
ITtelligence mirror: KeepDHCPAddressSetup.zip (207 Kb)

How to Use ItLink to this section

Run Setup.exe as an administrator. It installs a Windows service called KeepDHCPAddress that runs as LocalSystem and needs .NET Framework 1.1. There are no parameters or settings.

Setup.exe
sc config KeepDHCPAddress start= auto
net start KeepDHCPAddress

Once a minute the service checks every DHCP-enabled adapter. While an adapter has a real lease it saves the address, subnet mask, gateways, DNS, WINS and NetBIOS settings to a file named after the MAC address, such as 00-11-22-33-44-55.ipconfig, in the service's working folder. If the adapter ends up with 0.0.0.0 or a 169.254.x.x address, the service applies the saved settings as static. About once an hour it switches every static adapter that has a saved file back to DHCP, and clears its DNS and WINS settings. If DHCP is still unavailable, the next check sets the static settings again.

Note: the installer does not set a start type, so the service is created as Manual and not started. Set it to automatic and start it as shown above. Any adapter that has a saved file and is later set to static by hand will also be switched back to DHCP within the hour.

No comments yet

Comments are moderated and appear once approved.