Page 1 of 1 1
Topic Options
#92454 - 2003-07-18 11:36 AM find dhcp servers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
in a win2k AD, with win2k DHCP servers

I need to programmatically find all dhcp servers. Even those on seperate subnets/sites

help.. I'm drowning... need dhcp servers.... ack.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#92455 - 2003-07-18 11:44 AM Re: find dhcp servers
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yuk !

in NT Reskit there was a tool to list all DHCP servers in subnet.

Don't know the name actually but know that it's there because we had once a mix of Networks in one of our Centers and this one helped me to spot the looney
_________________________



Top
#92456 - 2003-07-18 11:48 AM Re: find dhcp servers
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Found it :

dhcploc.exe to be found in the NT 4.0 Servers resource kit (Ummm Sup. 4 I think)

[Ooops. We're in COM forum; So you search for a script not a way to s(h)ell out, eh ?]

[ 18. July 2003, 11:56: Message edited by: Jochen ]
_________________________



Top
#92457 - 2003-07-19 12:05 AM Re: find dhcp servers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and I can code it without com, but that should be little slooow.
and supports only wintosh dhcp.
_________________________
!

download KiXnet

Top
#92458 - 2003-07-19 12:26 AM Re: find dhcp servers
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ja.

even dhcploc is a slow fart, but that is not so dependant on the code but the task to accomplish, me thinx.
_________________________



Top
#92459 - 2003-07-18 01:00 PM Re: find dhcp servers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it only works on the local subnet...

it basically send a request packet and displays the ack and IP of the server giving it
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#92460 - 2003-07-18 01:08 PM Re: find dhcp servers
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
thats why it's slow, Ja.

But it fits your need, no ?

No, it doesn't fit; saw that now as I reread your post [Frown]

[ 18. July 2003, 13:09: Message edited by: Jochen ]
_________________________



Top
#92461 - 2003-07-18 01:16 PM Re: find dhcp servers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, my code might be better or even faster.
take all the servers in your corp into array and check their registry or wmi for running DHCP server-service [Wink]
_________________________
!

download KiXnet

Top
#92462 - 2003-07-18 01:52 PM Re: find dhcp servers
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hmmm ... that's the easiest way.

I don't think that your environment changes too often or even dynamically regarding DHCP Servers, so this is kind of listing/surveillance script easily done by doing


;build your array here

'List of DHCP Servers :' ? ?
for each $Server in $asServers
shell '%ComSpec% /c xnet list \\' + $Server + ' |find /c "DHCPServer" >nul'
if not @error
$Server ?
endif
next


[Wink]
_________________________



Top
#92463 - 2003-07-18 04:59 PM Re: find dhcp servers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
If I have to code the list of servers, why not just just list the DHCP servers.

I know this is a hard one... I'm thinking that DHCP servers have to be authorized in a win2k domain, so they have to be listed in AD somewhere.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#92464 - 2003-07-22 06:21 AM Re: find dhcp servers
BogdanSUA Offline
Fresh Scripter

Registered: 2002-08-13
Posts: 11
Loc: Chicago
Can you tell us why you need to find DHCP servers? It might help in the end solution. Are you having problems with people bringing up unauthorized DHCP servers?
Top
#92465 - 2003-07-23 12:16 AM Re: find dhcp servers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I have a WOL routine, that queries the DHCP servers for the computername/Mac address.

I want the script to automatically discover the dhcp servers without me hardcoding the server addresses.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#92466 - 2003-07-22 01:18 PM Re: find dhcp servers
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
Rad,

I know this a bit off topic (apologies for that) but is there any chance you could post what you're doing with WoL? I'm interested in using it for our remote disaster recovery site, but not sure what would be a good way to implement/use the technology.

Thanks,

Breaker
_________________________
================================================
Breaker


Top
#92467 - 2003-07-22 03:05 PM Re: find dhcp servers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
see:

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=004484
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=14;t=000892
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#92468 - 2003-07-22 03:51 PM Re: find dhcp servers
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
KSMS also uses WOL, see KiXtart Systems Management Server (Part III, The Client) [a.k.a The Complete Package]
_________________________
There are two types of vessels, submarines and targets.

Top
#92469 - 2003-07-23 03:16 AM Re: find dhcp servers
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Rad,
All Windows 2000 DHCP servers are registered in Active Directory, so it should be simple enough to query AD for them. I was looking for a COM method but so far have only found the following Q article.

How to Use Netsh.exe to Authorize, Unauthorize and List DHCP Servers in Active Directory (303351)
http://premier.microsoft.com/premier/library/default.aspx?scid=kb;en-us;303351
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#92470 - 2003-07-23 10:15 AM Re: find dhcp servers
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Les,

you are aware that you post links for privileged ppl, are you ?

[Wink]
_________________________



Top
#92471 - 2003-07-23 11:00 AM Re: find dhcp servers
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Here is that link for those without the Microsoft Premier account

http://support.microsoft.com/default.aspx?scid=kb;en-us;303351

You might also be able to use code that queries the SERVERS OU in AD with code something like this.

UNTESTED CODE


For each $server in $serverlist
$DHCP=ReadValue('HKLM\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters', 'DhcpLogFilePath')
? 'Server '+$server+' lists the DHCP log path as: '+$DHCP
Next

Top
#92472 - 2003-07-23 02:23 PM Re: find dhcp servers
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
J,
Yes, I was aware of it. That is why I also posted the full title to the Q article. I figured Rad to be privileged too.

If people are unable to find the poor man's Q article then they should be flipping burgers instead.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#92473 - 2004-06-14 08:58 PM Re: find dhcp servers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
got it..


cmd /c netsh dhcp show server |find "Address"
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.076 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org