Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Servers not Computers using ADSI and VBS

Status
Not open for further replies.

DROFNUD

MIS
Oct 16, 2001
40
GB

In VBS using ADSI and this code:

Set ou = getObject( "WinNT://" & DOMAIN )
ou.filter = "Computer"
for each computer in ou
...
next

I can use the filter to extract computers from a domain.

Hw do I tell the difference between Servers and Workstations, or Domain controllers against member servers? There must be a property to differentiate them, but I can't find it.

Cheers in advance
Simon...
 

Soory that scriptlet shoul'd have read:

Set ou = getObject( "WinNT://" & DOMAIN )
ou.filter = array("Computer")
for each computer in ou
...
next
 
I am working on it. I know it is possible.

One way I have figured out is to do the following:

Code:
set g_oComputers = getObject("LDAP://CN=Computers,dc=DOMAIN,dc=COM")

for each oPC in g_oComputers
  msgbox g_oPC.OperatingSystem
next

This will print out the OS of each computer in that container. Win2K Server would be: "Windows 2000 Server". You could easily do a IF statement to find which are servers and which are PCs.

If that doesn't work for you I can keep looking. Let me know.

Roger
 
Roger,

Win2000 Active directory and Exchange are LDAP directories, NT isn't. You can only use the Winnt provider on an NT network.

So the sample provided won't work, thanks though.
Si...
 
I realized that after I had posted. Even though both work in a W2K domain interestingly enough. I am still trying to find a reliable way in a NT4.0 domain.

Roger
 

It's odd! There has to be something in there to differentiate them.

I suppose I could look for the NETLOGON share to identify a domain controller, but this wouldn't help in identifying the PDC or other servers.

Is there a service that is unique to servers?

Thanks,
Si...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top