Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


LDAP - How to list all DHCP scopes on a Server

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,50329
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> LDAP - How to list all DHCP scopes on a Server
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 LDAP - How to list all DHCP scopes on a Server - 8/2/2007 10:03:08 PM   
  Spooner

 

Posts: 41
Score: 0
Joined: 4/16/2007
From: Blighty
Status: offline
Hi all,

Been scratching around for a couple of days now trying to find out how to use LDAP to produce a list of all DHCP Scopes on a Server that has many.

I have this so far which gets the DHCP servers (but not all for some reason) -

strForestRootDN = "dc=yy,dc=zz,dc=com"
set objCont = GetObject("LDAP://CN=DhcpRoot,CN=NetServices,CN=Services," & _
                        "CN=Configuration," & strForestRootDN)
colDHCPServers = objCont.GetEx("dhcpServers")

What I can't find out is what command will list all the DHCP scopes on the DHCP Servers found in the above script...

any idea anyone?
 
 
Post #: 1
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/4/2007 2:00:26 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Yucko.  Dealing with configuring DHCP via script is always messy/ugly.
You could try using netsh...
You might also give DHCPCMD a try...

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to Spooner)
 
 
Post #: 2
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/6/2007 1:01:55 AM   
  Spooner

 

Posts: 41
Score: 0
Joined: 4/16/2007
From: Blighty
Status: offline
Yep, your not wrong...

if I could find where the lease time is held in AD it would be astart, but I can't even find that.

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/6/2007 7:06:12 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
Listing DHCP scopes is EASY! But not using LDAP.

The tool to use is NetSH as it shows in the code below, we have a complex DHCP structure using 2 DHCP servers doing load balancing.
We have over 16000 DHCP scopes.

Be sure to remove code that may look at more then one server and remember to put the server names in.


      

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to Spooner)
 
 
Post #: 4
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/6/2007 7:09:20 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
FYI stay with NetSH for DHCP stuff, DNS is integrated but DHCP is not ... doen well.
I have a bunch of scripts I use for looking at leases, scopes, and other fun stuff.
If you're interested I'll post them.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to mcds99)
 
 
Post #: 5
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/6/2007 7:32:47 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
I forgot to tell you one important bit of information.

You will need the dhcpmon.dll helper added to netsh.
I believe it is in the adminpak.

the command to install it is...

netsh add helper dhcpmon.dll

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to Spooner)
 
 
Post #: 6
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/6/2007 10:55:39 PM   
  Spooner

 

Posts: 41
Score: 0
Joined: 4/16/2007
From: Blighty
Status: offline
mcds99,
 
Thank you very much and can I ask you to post up your scripts for looking at leases, scopes, and other fun stuff - I need to take them apart and learn how it works.

What i'm particularly interesting in is being able to display the lease time of each scope held in 'Option Id : 51' and to be able to display the Statistics of the scope ie. what % is used.

thanks again

< Message edited by Spooner -- 8/6/2007 11:41:49 PM >


_____________________________

'The only stupid question is the one that's never asked'

(in reply to mcds99)
 
 
Post #: 7
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/8/2007 6:19:09 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
Well NetSH really doesn't do Lease information.

You will need to us dhcpcmd.exe for that.

be sure to change  "IP OF THE SERVER" to your dhcp server.



      

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to Spooner)
 
 
Post #: 8
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/9/2007 4:34:57 AM   
  Spooner

 

Posts: 41
Score: 0
Joined: 4/16/2007
From: Blighty
Status: offline
Thanks for that code - I think I've come across it before somewhere.

I'm not looking for Client IP leases though .. I want to find out what each scope on a dhcp server is set to.

DHCPCMD - Is it OK to use on 2003 server? I've only seen it referenced with NT4 ??

_____________________________

'The only stupid question is the one that's never asked'

(in reply to mcds99)
 
 
Post #: 9
 
 RE: LDAP - How to list all DHCP scopes on a Server - 8/9/2007 5:58:51 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
Just don't use it to add anything.

You may need to do some math in your scripts to get the % of scope utilization.

I'm off to a meeting.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to Spooner)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> LDAP - How to list all DHCP scopes on a Server Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts