Link to home
Start Free TrialLog in
Avatar of Joseph Moody
Joseph MoodyFlag for United States of America

asked on

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!
Avatar of Brian
Brian
Flag of United States of America image

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
Avatar of Joseph Moody

ASKER

Does that grab any computers in sub OUs?
ASKER CERTIFIED SOLUTION
Avatar of Brian
Brian
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AmazingTech
AmazingTech

Download and install the Server Resource Kit and use DSQUERY

dsquery computer -o rdn -limit 0 "cn=computers,dc=vch,dc=ca">Machines.txt
That worked perfect (used the vbs solution)! Thanks!