Page 1 of 1 1
Topic Options
#51646 - 2000-10-05 11:39 AM creating list of domain members based on IP
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Hi all!!

I am currently in the process of installing the SU service for admin purposes using a few scripts kindly written by Bryce. Nice one Bryce!!! The script requires a list of computers in the domain which I have got. But I don't wanna do it that way.....I wanna be difficult.

I want to be able to create a list of computers in our domain based on IP e.g. 10.8.x.x. Why? well we have several offices spread across and the only thing that differenciates them is the IP and I want to do it office by office. I could do it over the WAN but I dont trust it. For example my office is 10.8.x.x and another office would be 10.2.x.x.


I can post the code if you like but i'm sure youve seen it before.

Regards

Ju

[This message has been edited by Julian (edited 05 October 2000).]

Top
#51647 - 2000-10-05 03:36 PM Re: creating list of domain members based on IP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
do you use DHCP?
Bryce

Top
#51648 - 2000-10-05 03:52 PM Re: creating list of domain members based on IP
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Yes we do.

Ju

Top
#51649 - 2000-10-05 04:02 PM Re: creating list of domain members based on IP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
hmmm... ok so a database of all ip#'s/computernames does exist....... this is where i would start looking (where i am currently looking....)

Your are using the MS DHCP server?

Bryce


Top
#51650 - 2000-10-05 04:05 PM Re: creating list of domain members based on IP
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Yes MS DHCP.

Ju

Top
#51651 - 2000-10-05 04:18 PM Re: creating list of domain members based on IP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
ok cool! now we are getting somewhere!

using the NT resource Kit tool dhcpcmd.exe, i found the following

dhcpcmd <dhcp server> enumclients <subnet>

It not only lists the ip#'s in use but it also list the computer names that are using those ip#'s!

code:

W:\NTReskit>dhcpcmd x.x.0.234 enumclients x.x.0.0
DHCP Server version 4.1
1 x.x.5.11 STARKR 11/01/2000 08:30:47
2 x.x.5.12 HARRISON 11/04/2000 07:48:04
3 x.x.5.13 CALDERON 11/04/2000 08:15:09
4 x.x.5.14 brinkleyr 11/04/2000 06:12:51
5 x.x.5.15 davisl 10/13/2000 15:35:16
6 x.x.5.18 %username% 10/28/2000 13:37:45
7 x.x.5.20 OSHCISMON 10/28/2000 09:09:30
8 x.x.5.21 RETURN_CHECKS 10/25/2000 19:55:46
9 x.x.5.23 rivasb 11/03/2000 08:44:01
10 x.x.5.24 FranklinJ 11/04/2000 09:13:10
11 x.x.5.25 steppm 10/26/2000 15:27:00
12 x.x.5.26 KCASTILLO 11/01/2000 09:30:30
13 x.x.5.27 SIMPSOND 11/04/2000 06:30:45
14 x.x.5.28 martinezp 11/04/2000 08:11:39
15 x.x.5.29 CMSWK002 10/14/2000 14:18:26
16 x.x.5.30 SOFTGOODS-REC 11/04/2000 07:25:32
17 x.x.5.31 RECEIVING1934 11/04/2000 05:27:07
18 x.x.5.32 COLET 11/01/2000 12:01:27
19 x.x.5.33 ALLAMM 11/03/2000 18:22:30
20 x.x.5.34 marbachj 11/03/2000 07:43:31
21 x.x.5.35 ARENSON 11/04/2000 08:00:22
22 x.x.5.37 RBRUMLEY 11/04/2000 08:29:59
23 x.x.5.38 Heckg 11/04/2000 06:38:52
24 x.x.5.39 HUGGHINSMA 11/02/2000 10:00:34
25 x.x.5.40 MCKINNIS 11/04/2000 08:25:28
26 x.x.5.41 fohe 11/04/2000 09:09:00
27 x.x.5.42 NGUYENH 11/03/2000 09:07:05
28 x.x.5.43 SHIPPING-1 11/04/2000 06:49:29
29 x.x.5.44 (null) 10/12/2000 10:18:31
30 x.x.5.45 wilsond 11/04/2000 06:39:16
31 x.x.5.46 BRUCE-WORK 11/01/2000 07:32:00
32 x.x.5.47 ROBLESE 11/04/2000 08:17:41
33 x.x.5.48 Security 11/03/2000 13:22:01
34 x.x.5.49 DAVIDWATTS 11/01/2000 06:45:51
35 x.x.5.50 james_hynson 10/22/2000 10:15:58
36 x.x.5.51 HAYDONC 10/27/2000 10:03:45
37 x.x.5.52 DONNELLYP 11/03/2000 16:51:51
38 x.x.5.53 (null) 10/25/2000 09:49:11
39 x.x.5.54 (null) 10/25/2000 09:05:38
40 x.x.5.55 RECEIVING 11/04/2000 06:37:11
41 x.x.5.56 SHIPPING2 10/27/2000 14:40:55
42 x.x.5.57 DENTONG 11/03/2000 17:34:54
43 x.x.5.58 crossdock 11/04/2000 06:48:47
44 x.x.5.59 toshiba-satlell 10/22/2000 16:55:00
45 x.x.5.60 BERNALN 10/21/2000 15:54:37
46 x.x.5.61 1620PC1 10/27/2000 09:47:07
47 x.x.5.62 ALLENL 11/03/2000 08:16:00
48 x.x.5.63 David Cortez 10/25/2000 15:57:19
49 x.x.5.64 JEFFERSK 11/04/2000 09:02:18
50 x.x.5.65 1620PC2 10/27/2000 09:23:26
51 x.x.5.66 (null) 11/03/2000 08:52:54
52 x.x.5.67 1620PC3 10/25/2000 16:32:53
53 x.x.5.68 PRINTSHOP 11/01/2000 09:27:32
54 x.x.5.69 MANSFIELD 10/20/2000 14:20:28
55 x.x.5.70 (null) 10/28/2000 08:32:10
56 x.x.5.71 TCOLE 10/29/2000 16:16:17
57 x.x.5.72 BRYCETEST 11/03/2000 12:59:56
58 x.x.5.73 1280pc 10/27/2000 15:30:30
59 x.x.5.74 HRTEMP 11/03/2000 11:19:38
60 x.x.5.75 output2 10/19/2000 11:58:43
61 x.x.5.76 1280compaq 10/28/2000 11:27:13
62 x.x.5.77 BRUCE-WORK 10/29/2000 09:53:03
63 x.x.5.78 ATCHISON 11/03/2000 08:37:45
64 x.x.5.79 FIEDLERR 11/02/2000 07:57:03
65 x.x.5.80 CALVERTD 10/29/2000 15:12:44
66 x.x.5.81 transmit 11/04/2000 08:42:35
67 x.x.5.82 HUTTOT 11/04/2000 08:16:42
68 x.x.5.83 OCARROLL 11/04/2000 07:50:11
69 x.x.5.84 GHOLDER 11/03/2000 14:31:46
70 x.x.5.85 1350PC 11/02/2000 15:56:31
71 x.x.5.86 (null) 11/02/2000 16:27:45
72 x.x.5.87 (null) 11/03/2000 10:44:20
73 x.x.5.88 BAD_ADDRESS 11/03/2000 16:41:12
74 x.x.5.89 PEREZM 11/04/2000 08:51:59
75 x.x.5.90 FARRELLS 11/04/2000 08:57:12
76 x.x.5.91 HOKANSOND 11/04/2000 08:59:34
77 x.x.5.92 JENNINGS 11/03/2000 16:48:50
78 x.x.5.93 BENJAMIN 11/04/2000 07:48:43
79 x.x.5.94 SFTTEMP 11/04/2000 07:56:58
80 x.x.5.95 bucka 11/04/2000 08:15:57
Command successfully completed.

Bryce

Top
#51652 - 2000-10-05 04:37 PM Re: creating list of domain members based on IP
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Now that looks more like what I want here. I'll have a little tinker with it and see what I can do.

Cheers

Ju

Top
#51653 - 2000-10-05 05:40 PM Re: creating list of domain members based on IP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
here ya go!

clist_by_ip.kix

code:

break on cls
;--------------------------------------------------------------------------
; This script will create a list of all NT computers ip# that are using DHCP
; and are in your domain. the file global.exe and dhcpcmd.exe is needed
; for this script to work.
;--------------------------------------------------------------------------


$tempfile = "%temp%\kix.tmp"
$outfile = "clistip.dat"
$domain = "<domain>"
$subnet = "10.2.0.0"
$DHCPServer = "10.2.0.234"


;--------------------------------------------------------------------------
$cr = chr(13)+chr(10)
$computername = ""
$subnetmask = substr("$subnet",1,instr("$subnet",".0"))
Gosub get_computername

? "Collecting data from DHCP Server($DHCPserver)"
shell '%comspec% /c dhcpcmd $DHCPServer enumclients $subnet | find "$subnetmask" > $tempfile'
$nul = open(1,$tempfile,2)
$data = readline(1)
if exist("$outfile") = 1 del $outfile endif
$nul = open(2,"$outfile",5)
? "writing $outfile"
do
$DHCPIP = rtrim(substr("$data",instr("$data","$subnetmask"),17))
$data = ltrim(substr("$data",20,len("$data")))
$DHCPcname = rtrim(substr("$data",1,instr("$data"," ")))
select
case instr("$computername","$dhcpcname") <> 0
$nul = writeline(2,"\\$dhcpcname$cr") "."
endselect
$data = readline(1)
until @error <> 0
$nul = close(1)
$nul = close(2)
del $tempfile


Exit
;--------------------------------------------------------------------------


:get_computername
? "Collecting all NT Computer Name's in Domain($domain)"
shell '%comspec% /c global "domain Users" "$domain" | find "$" > $tempfile'
$nul = open(1,$tempfile)
$temp = readline(1)
do
$computername = $computername + substr($temp,1,len($temp)-1) + ","
$temp = readline(1)
until @error <> 0
$nul = close(1)
del $tempfile
return


Bryce

[This message has been edited by Bryce (edited 05 October 2000).]

Top
#51654 - 2000-10-05 05:56 PM Re: creating list of domain members based on IP
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Now that is something else, how long u been writing this stuff for man, top quality, hope I can do it sometime.

But just one little thing. My clistip.dat is in the format:

\\10.8.0.69
\\10.8.0.111
\\10.8.0.116
\\10.8.0.117
\\10.8.0.121
\\10.8.0.122

Can it be modified so its in the the format

\\LINDA_HOLLAND
\\FRANCINE_OGORMA
\\SUSANB
\\SUES_LAPTOP
\\RICHARD_WOOLLEY
\\GILL_MURPHY

Regards

Ju

Top
#51655 - 2000-10-05 06:17 PM Re: creating list of domain members based on IP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I first found kix about a year ago now, but I was just using it for a realy simple logon script....

Then I needed something with more power than a bat file and turned to kix, hanen't gone back since

to change the format is easy

change

code:

select
case instr("$computername","$dhcpcname") <> 0
$nul = writeline(2,"\\$dhcpip$cr") "."
endselect

to

code:

select
case instr("$computername","$dhcpcname") <> 0
$nul = writeline(2,"\\$dhcpcname$cr") "."
endselect


Bryce

Top
#51656 - 2000-10-06 10:01 AM Re: creating list of domain members based on IP
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Bryce - you really are a *STAR*.

ta very much!

Ju

Top
Page 1 of 1 1


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

Who's Online
0 registered and 641 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.063 seconds in which 0.027 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