Brandon said:
What is the easiest way to query AD for all the computers in the domain and
list them in a text file?
Hi,
In ADUC you can filter for all computers with the LDAP query:
(objectCategory=computer)
However, thats not a list. You probably need a script. Using the WinNT
provider, the following will echo the computer names to the console, which
can be redirected to a text file:
Set objDomain = GetObject("WinNT://MyDomain")
objDomain.Filter = Array("computer")
For Each objComputer In objDomain
Wscript.Echo objComputer.Name
Next
If the script is in a file called Computers.vbs, then run it at a command
prompt as follows:
cscript //nologo Computers.vbs > Report.txt
Otherwise, you can use ADO in a script to retrieve any info you want on
computer objects. For details, see:
http://www.rlmueller.net/ADOSearchTips.htm
The first example in this link can be easily modified to output
sAMAccountName (NT names) for all computers by replacing the filter for
users with the one above for computers.