Welcome to TechNet Blogs Sign in | Join | Help

Microsoft Windows DHCP Team Blog

The world's most deployed DHCP Server! Deploy and discuss about your fav. server, here!
Script to display ALL the reserved addresses configured on the DHCP server.

The Microsoft DHCP server provides show command to display reserved addresses configured at a particular scope level. But diplaying ALL the reserved addresses configured in ALL the scopes in the server is not possible with a single command.

 You can make use of the below script (Batch File) to display the reservations for all the scopes configured in the server. An intermidiate file named "display.nsh" will be created in the current folder but it gets deleted once the script execution completes.

 

 Note:  The below script contents are for running as a batch file. If you are running directly on the console (ie not as a batch file), please replace all occurrences of %%i in the script with %i.

 

 

Script for DHCPV4 (Display_DHCPV4_Reservations.bat)

*********************************************************************************************************

@echo off

del display.nsh > nul 2> nul

for /F "skip=4 tokens=1 delims== " %%i in ('netsh dhcp server show scope') do if NOT %%i == Total if NOT %%i == Command echo dhcp server scope %%i show reservedip >> display.nsh

netsh -f display.nsh

del display.nsh > nul 2> nul

*********************************************************************************************************

 

 

Script for DHCPV6 (Display_DHCPV6_Reservations.bat)

 

*********************************************************************************************************

@echo off

del display.nsh > nul 2> nul

for /F "skip=4 tokens=1 delims== " %%i in ('netsh dhcp server v6 show scope') do if NOT %%i == Total if NOT %%i == Command echo dhcp server v6 scope %%i show reservedip >> display.nsh

netsh -f display.nsh

del display.nsh > nul 2> nul

*********************************************************************************************************

 

Thanks,

Gnana Pandian.C

Team DHCP.

Posted: Friday, April 18, 2008 4:58 PM by teamdhcp

Comments

JefTek.com said:

It appears the Networking team is looking for feedback on how to improve future releases of the Microsoft DHCP server role in Windows Server. For me, the first thing that comes to mind is: Add WMI support This has always been one of the "Duh" points in

# May 21, 2008 11:47 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker