'GetComputerList.vbs 'v1.1 'Jeffery Hicks 'jhicks@jdhitsolutions.com http://www.jdhitsolutions.com 'USAGE: CSCRIPT //NOLOGO GETCOMPUTERLIST.VBS 'DESC: Enumerate computer accounts for specified domain 'NOTES: You should use CSCRIPT to run this script 'If you want to save results, use console redirection: 'ccript getcomputerlist.vbs >mycomputers.txt 'or modify the script to create file using the FileSystemObject. On Error Resume Next dim objDomain,wshNetwork Set wshNetwork=CreateObject("WScript.Network") strDomain=wshNetwork.UserDomain Set objDomain = GetObject("WinNT://" & strDomain) count=0 objDomain.Filter = Array("computer") For Each x in objDomain If x.fullname<>"" Then wscript.echo x.name count=count+1 End If Next wscript.echo VBCRLF & "Counted " & count & " computer accounts in the " & domain & " domain." Set objDomain=Nothing wscript.quit