Hoe to move a bunch of systems into an OU at once

I need to move about 100 system to a particular OU in AD. How can I do all at once?
rdefinoAsked:
Who is Participating?
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.

becraigCommented:
if you have a list of computers you can use powershell

import-module ac*
gc c:\serverlist.txt | % {
Get-ADComputer $_| Move-ADObject -TargetPath "ou=something,dc=mydomain,dc=com"
}

Open in new window

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
rdefinoAuthor Commented:
Do I enter the commands line by line like you have them?
0
rdefinoAuthor Commented:
Also how server list be formatted?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

becraigCommented:
you can(from a powershell window) or you can save it as a powershell script

script.ps1 and run it from a powershell window as script.ps1

Server list will be one server name per line...
E.g

SERVER1
SERVER2
SERVER3
0
rdefinoAuthor Commented:
if the ou you is buried down say 3 levels like:

machines-win7-systems

Do show it in the script like that?

ou=machines,ou=win7,ou=systems
0
becraigCommented:
You can use simple AD command to find the correct OU

dsquery computer -name <computername>

The output from this would show you the OU (minus the computer name portion)
0
rdefinoAuthor Commented:
Actually the OU I'm moving them to is buried 3 levels down. Wasn't sure how to show that in the script.

Looks like i only need a target OU, not the source...correct?
0
becraigCommented:
Yup you only need the target, so my suggestion was to simply query a computer already in the target OU to get the correct value.
0
rdefinoAuthor Commented:
Great work!!
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
Windows Server 2008

From novice to tech pro — start learning today.

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.