Board index » delphi » Getting all the machine addresses in domain?

Getting all the machine addresses in domain?

Hi!

I wonder if there is a way to find out all the machine addressess in a
certain domain?

eg. All the machine under the domain stir.ac.uk

And also, how to implement this using winsock components?

Cheers

Johan

 

Re:Getting all the machine addresses in domain?


Quote
jl...@students.stir.ac.uk (Johan Lindquist) wrote:
>Hi!

>I wonder if there is a way to find out all the machine addressess in a
>certain domain?

Sure...but the program must be running on an NT server.
Use this fuction (from the Win32 Help file):
---------------- Cut here ----------------------
NetUserEnum provides resumable enumeration of information about each user
account in a domain.

Security Requirements

Admin or account operator group membership is required to successfully execute
NetUserEnum at levels 1 and 2. No special group membership is required at level
0 or 10.

NET_API_STATUS
NetUserEnum (

    LPWSTR servername,  
    DWORD level,        
    DWORD filter,      
    LPBYTE * bufptr,    
    DWORD prefmaxlen,  
    LPDWORD entriesread,        
    LPDWORD totalentries,      
    LPDWORD resumehandle        
   );  

----------------- Cut Here ------------------
This function (and others (NETgroup, NetUser, etc) are in (mostly) the
Netapi32.DLL -  which Delphi does not provide a header file for.  Ya got ta roll
your own, I'm afraid.

Quote

>eg. All the machine under the domain stir.ac.uk

>And also, how to implement this using winsock components?

>Cheers

>Johan

Other Threads