'==========================================================================
'
' NAME: <EnumerateDomainComputers.vbs>
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL:
' DATE : 5/20/2004
'
' COMMENT: generates a list of domain computers
' MODIFICATIONS: Added support to automatically find the Domain NetBIOS Name
'==========================================================================
Dim objIADsContainer ' ActiveDs.IADsDomain - ' Container object
Dim objIADsComputer ' ActiveDs.IADsComputer
Dim Partition, Partitions
Set Partitions = GetObject("LDAP://CN=Partitions,CN=Configuration," & _
GetObject("LDAP://RootDSE").Get("DefaultNamingContext"))
On Error Resume Next
For Each Partition In Partitions
strDomain = Partition.Get("nETBIOSName")
If Err.Number = 0 then Exit For
Next
Set Partitions = Nothing
' connect to the computer.
Set objIADsContainer = GetObject("WinNT://" & strDomain)
' set the filter to retrieve only objects of class Computer
objIADsContainer.Filter = Array("Computer")
For Each objIADsComputer In objIADsContainer
report = report & objIADsComputer.Name & vbCrLf
Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile ("wslist.txt", ForWriting)
ts.write report
Set fso = Nothing
Set objIADsComputer = Nothing
Set objIADsContainer = Nothing
MsgBox "Done"
Marty
Network Admin
Hilliard Schools