Solved

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

Posted on 2014-09-09
9
98 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 28

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
 
LVL 28

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 28

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 28

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

Join & Write a Comment

A procedure for exporting installed hotfix details of remote computers using powershell
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now