Move Multiple Users to Different OU Using PowerShell Script / CSV (2024)

Move Multiple Users to Different OU Using PowerShell Script / CSV (1)

PublishedBy Aswin Vijayan

Move Multiple Users to Different OU Using PowerShell Script / CSV (2)

ApprovedBy Anuraag Singh

PublishedOn October 4th, 2023

ReadingTime 5 Minutes Reading

Category Cloud Migration

Move Multiple Users to Different OU Using PowerShell Script / CSV (3)

PowerShell is made up of command line shell to automate cross platform tasks. PowerShell commands can be run on Windows OS, Linux, and Mac OS all versions. This post will guide you to move multiple users to different OU using PowerShell commands. Let us get started!

Before Proceeding Note: PowerShell is a scripting language command line that need to be perform with perfection. If you are not familiar with this, then you may find difficulty to perform the below task. In this case, you may find third party tools handy to move multiple users to another OU.

Methods to Move Users to Different OU

There are multiple ways to move multiple users to another organizational unit. All are listed below. Choose the method that best suites in your situation.

  • Move Users to Different OU Using PowerShell
  • Move AD Users to Different OU Using CSV File
  • Third-Party Tool to Move Multiple Users to Different OU

Let us explain each method in detail.

Method-1: Move AD Users to Different OU using PowerShell Script

My recommendation is to use Move-AdObject command to easily move AD users to different OU. Perform below listed script:

Note: This command will allow you to move single users to other OU at a time.

Get-ADUser -Identity Mack.John | Move-ADObject -TargetPath “OU=Marketing,DC=VMLAB,DC=LOCAL”

AD admin can understand this command easily but for novice users it is very hard to understand it. So, let us understand this PowerShell command in details.

This command contains two different sections, in the first section it instructs to fetch the user from source i.e. Mack.John.

In the second phase you need to select the destination Organizational Unit. The command will pick the user from source and move to selected destination OU i.e., Marketing in this case.

Method-2: Move Users to Organizational Unit using CSV File

Using CSV file for user authentication and destination selection can help to move multiple users to different OU at the same time.

Command given below to move multiple users to different OU using CSV has been listed below. Simply follow the instructions and get migrated.

$adUsers = Import-Csv -Path “C:\PowerShell\moveuser.csv”
$TargetOU = “OU=Marketing,DC=VMLAB,DC=LOCAL”
$adUsers | ForEach-Object {

# Get ad user
$aduser = (Get-ADUser -Identity $_.SAMAccountName).distinguishedName

Write-Host “Move ad user” $aduser

# Move user to target OU
Move-ADObject -Identity $aduser -TargetPath $TargetOU
}

The above command seems quite confusing and a non tech user cannot understand it properly. Get detailed explanation of each section:

Import-Csv: This command allows to import the CSV file from the specified path. After that fetch the information from CSV and store it into $adUsers variable.

$TargetOU: Variable to will contain the destination OU path to move user to different OU.
The process will continue for all entries of CSV file.

Method-3: Move Multiple Users to Different OU Using Professional Tool

PowerShell command are tedious to execute and can occur error while moving AD user to different OU. To overcome all shortcomings of PowerShell commands, SysTools developed an advanced Active Directory Migrator Software. It allows to migrate multiple users to different OU without any limitation.
The software is developed with cutting edge technology, so anyone can use it. It makes the migration process quite easy. Let us discuss the working steps:

Steps to Move AD Users to OU Directly

Follow the below listed steps and move all users without any limitation.

Download for Windows Purchase Now

Step-1: Download and install the software on your system. After that login using your Administrator credentials. For this provide User ID, Password and hit LOGIN button.

Move Multiple Users to Different OU Using PowerShell Script / CSV (4)

Step-2: Do mouse click on Register Domain Controller and provide required details like: Domain Friendly Name and IP Address. Provide same details for destination domain also.

Move Multiple Users to Different OU Using PowerShell Script / CSV (5)

Step-3: Now the new window will appear with the list of Source and Destination domain. From this screen you need to fetch the objects from source domain and match it with the destination.

Move Multiple Users to Different OU Using PowerShell Script / CSV (6)

Step-4: Create migration scenario by tapping on Migration option from left bar. Here provide scenario name and select source and destination. After that hit Save & Continue button and Create Task.

Move Multiple Users to Different OU Using PowerShell Script / CSV (7)

Step-5: Its time to select objects that you want to move source user to other OU. Simply select User and then map the objects with destination OU.

Move Multiple Users to Different OU Using PowerShell Script / CSV (8)

Step-6: Now a window will appear names as Migration Options, select the Create radio button and hit Select.

Move Multiple Users to Different OU Using PowerShell Script / CSV (9)

Step-7: After completing the user migration to different AU, the tool will show the progress report. Check status, if completed means you have successfully moved multiple users to different AU directly.

Move Multiple Users to Different OU Using PowerShell Script / CSV (10)

Conclusion

This write-up is intended to help users to move multiple users to different AU using PowerShell cmdlet. 3 different methods are explained in above sections. Find the best one that suites in your situations.

Author’s Recommendation: If you are techie and AD administrator then you give a try to PowerShell commands. Otherwise, its better go with third-party software to easy and error less process to move AD users to different AU.

Get expert guide on how to migrate computer from one domain to another

Move Multiple Users to Different OU Using PowerShell Script / CSV (2024)
Top Articles
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 6266

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.