Solved

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

Posted on 2013-01-07
2
634 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
ID: 38751168
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
ID: 38751324
works great. thx
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

830 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