Solved

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

Posted on 2014-09-09
9
101 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
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.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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