Monday, December 12, 2011

Get all active leases on all DHCP servers


echo off

for /F "eol== tokens=7" %%d in ('netsh dhcp show server') do if NOT %%d==directory call :S1 %%d

GOTO :END

:S1
echo ============================================
echo Scopes on %2
echo ============================================

for /F "eol== tokens=1" %%i in ('netsh dhcp server \\%2 show scope') do if NOT %%i==Scope if NOT %%i==Total if NOT %%i==Command netsh dhcp server \\%2 scope %%i show clients 1

:END

No comments:

Post a Comment