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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
BrianIT 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.