When you get a request to add a printer or any device for DHCP reservation with MAC address, it’s a hassle to find the hosting DHCP servers and have add it on both servers. If you read this you already know how to do it with DHCP MMC console.
To make this process easy, I wrote a batch files for different DHCP server (sets/scopes) and add the reservation in one single step using NETSH command.
I created one batch file for each DHCP servers set which shares the scopes. Without further due, here is my batch file.
REM Usage: DHCPReserve <Scope> <IP Address> <MAC address> <Description>
REM <Scope> is like 192.168.10.0
REM <IP Address> is assigned IP address for the device, eg., 192.168.10.15
REM <MAC Address> is the device’s MAC address without dash or spaces e.g., 0013FA0191C2
REM <Description> is anything you like about the device
netsh dhcp server <Server1.domain.com> scope %1 add reservedip %2 %3 %4
netsh dhcp server <Server2.domain.com> scope %1 add reservedip %2 %3 %4
Copy and paste the above script in notepad and save it as DHCPReserve.bat. Run it with proper parameters as in remarks section in teh script.
2 thoughts on “DHCP Reservation Entry: Batch file solution”
Hi there, any way to make the script prompt me for parameters introduction?? Thanks
How can I run this batch file in code? I want to do reservation for two different machine but I didnt do it.