Solved

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

Posted on 2014-09-09
9
102 Views
Last Modified: 2014-09-09
I need to move about 100 system to a particular OU in AD. How can I do all at once?
0
Comment
Question by:rdefino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 29

Accepted Solution

by:
becraig earned 500 total points
ID: 40313390
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
 

Author Comment

by:rdefino
ID: 40313415
Do I enter the commands line by line like you have them?
0
 

Author Comment

by:rdefino
ID: 40313417
Also how server list be formatted?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:becraig
ID: 40313419
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
 

Author Comment

by:rdefino
ID: 40313425
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
 
LVL 29

Expert Comment

by:becraig
ID: 40313432
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
 

Author Comment

by:rdefino
ID: 40313441
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
 
LVL 29

Expert Comment

by:becraig
ID: 40313447
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
 

Author Closing Comment

by:rdefino
ID: 40313466
Great work!!
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question