Script to export all computers in an OU and Sub-OUs into text file

Hello Everyone!

I am wondering if it is possible to have a script that exports a list of all computers in an OU and any sub OUs into a text file and have each computer name on a separate line. I do not have the faintest idea on where to begin so any help would be great!

Thanks!
LVL 22
Joseph MoodyBlogger and wearer of all hats.Asked:
Who is Participating?
 
BrianConnect With a Mentor IT ManagerCommented:
No it will not.  But I did just find this similar post that may help you.
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/2003_Server/Q_22494511.html

Brian
0
 
BrianIT ManagerCommented:
Have you tried just right clicking on the OU and selecting Export List...?  You then can do a CTRL H and find Computer and leave Replace blank to remove it.  That should work for you.

Thanks,
Brian
0
 
Joseph MoodyBlogger and wearer of all hats.Author Commented:
Does that grab any computers in sub OUs?
0
 
AmazingTechCommented:
Download and install the Server Resource Kit and use DSQUERY

dsquery computer -o rdn -limit 0 "cn=computers,dc=vch,dc=ca">Machines.txt
0
 
Joseph MoodyBlogger and wearer of all hats.Author Commented:
That worked perfect (used the vbs solution)! Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.