Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-09-09
9
Medium Priority
?
103 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 2000 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
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

722 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