Solved

need a quest AD CMDLET or POSH script to bulk move user accounts to another OU

Posted on 2013-01-07
2
629 Views
Last Modified: 2013-01-07
looking for a script to bulk move users to another OU based on a .CSV input file.

thx in advance.

S.
0
Comment
Question by:siber1
2 Comments
 
LVL 12

Accepted Solution

by:
FDiskWizard earned 500 total points
Comment Utility
Pretty simple to do that. Need userid/name, or user-specific in the csv.
See below, from this site:
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/dd9821b9-9c49-4d93-b5af-c79f927d724c/


# Specify target OU.
$TargetOU = "ou=NewUsers,ou=West,dc=MyDomain,dc=com"

# Read user sAMAccountNames from csv file (field labeled "Name").
Import-Csv -Path Users.csv | ForEach-Object {
    # Retrieve DN of User.
    $UserDN = (Get-ADUser -Identity $_.Name).distinguishedName

    # Move user to target OU.
    Move-ADObject -Identity $UserDN -TargetPath $TargetOU
}
0
 

Author Closing Comment

by:siber1
Comment Utility
works great. thx
0

Featured Post

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
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…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

762 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

6 Experts available now in Live!

Get 1:1 Help Now