Solved

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

Posted on 2014-09-09
9
100 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
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
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 bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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