DSQUERY to find all computer names in an OU
I am trying to find all the computer names in a specific OU in AD (Server 2008 R2) and print them out to a text file using DSQUERY. Does anyone have the proper syntax? I am running from cmd line as admin and not having much luck?
2 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
SMal.tmcc
9 years ago
Top Answer
not at a domain computer to test but according to
https://technet.microsoft.com/en-us/library/cc730720.aspx
it should be like this
http://social.technet.microsoft.com/wiki/contents/articles/2195.active-directory-dsquery-commands.aspx
https://technet.microsoft.com/en-us/library/cc730720.aspx
it should be like this
dsquery computer OU=Sales,DC=Contoso,DC=Com > file.txtalso see this for other dsquery calls
http://social.technet.microsoft.com/wiki/contents/articles/2195.active-directory-dsquery-commands.aspx
Comments:
-
dsquery.exe computer -name %COMPUTERNAME% > file.txt - aragorn.2003 9 years ago
ou=OUwithinMyTopOU,OU=MyTopOU,DC=XXX,DC=XXX,DC=XXX,DC=XXX >> computers.txt -limit 999
Everything worked perfect!
Thanks again. - Newbie0000 9 years ago