How can I retreive a list of all the clients on a given domain? (either by name or ip)
Printable View
How can I retreive a list of all the clients on a given domain? (either by name or ip)
First of all download and install ADSI from
http://www.microsoft.com/ntworkstati...6redirect%3Dno
Then try this code as a VBScript
Hope this helpsCode:Set WshNetwork = CreateObject("WScript.Network")
Set WshGroups = CreateObject("Scripting.Dictionary")
WshGroups.CompareMode=vbTextCompare
DomName = WshNetwork.UserDomain
msgbox "Domain Name = " & DomName
Set DomComp = GetObject("WinNT://" & WshNetwork) ' DomName
DomComp.filter = Array("computer")
For each Computer in DomComp
msgbox Computer.Name
Set ComputerLogon = GetObject("WinNT://" & DomName & "/" & Computer.Name)
ComputerLogon.filter = Array("user")
For each User in ComputerLogon
msgbox Computer.Name & "-" & User.Name
Next
Next
RegardsCode:Set WshNetwork = CreateObject("WScript.Network")
Set WshGroups = CreateObject("Scripting.Dictionary")
WshGroups.CompareMode=vbTextCompare
DomName = WshNetwork.UserDomain
msgbox "Domain Name = " & DomName
Set DomComp = GetObject("WinNT://" & DomName) '
DomComp.filter = Array("computer")
For each Computer in DomComp
msgbox Computer.Name
Set ComputerLogon = GetObject("WinNT://" & DomName & "/" & Computer.Name)
ComputerLogon.filter = Array("user")
For each User in ComputerLogon
msgbox Computer.Name & "-" & User.Name
Next
Next