Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Check number of available DHCP addresses

Check number of available DHCP addresses

Check number of available DHCP addresses

Does anyone know of a script or other method to query the number of available DHCP addresses on NT4/W2K servers?  We have a number of servers at different sites and I want to set up monitors to alert me when a certain trigger level is reached, but I'm not sure how to query the number of addresses.  Any help greatly appreciated.



RE: Check number of available DHCP addresses

I've been using the following in a batch file:

@echo off
dhcpcmd 123.456.789.101 mibcounts >mibcounts.log
dhcpcmd 123.456.789.101 enumclients 123.456.789.0 >789pool.log
dhcpcmd 123.456.789.101 enumclients 123.456.788.0 >788pool.log
dhcpcmd 123.456.789.101 enumclients 123.456.787.0 >787pool.log
doze 300
goto getmibcount

123.456.789.101 is my DHCP server
mibcounts gets a summary of the dhcp server with # of addresses free and used and total for all scopes configured.
123.456.789.0, 123.456.788.0, 123.456.787.0 are my scopes which get dumped to the respective log text file.  This displays all the clients using addresses.

Schedule this batch file to run using Task Scheduler so it runs in the background on your DHCP server(s).  It will loop every 5 minutes (300 seconds).

You'll need to get doze.exe ... I think it's in the NT4 ResKit.
It will dump the results to the logs.  Then you can just view those logs whenever you wish to see the status updated every 5 minutes.

I've gone one step further and incorporated those logs into a web page so I can visit that page and at a glance see the usage.  Then click on the scopes to see the break down of clients.


RE: Check number of available DHCP addresses

Oh forgot your part about setting up trigger alerts.  If you have access to some back page processor on a web server, you could have it automatically check the web page like I have created and if the free addresses are at or below a certain number, send you an email or page.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close