This script is short and simple to move users from CSV file to targeted OU. You just need to modify the Target OU and the imported Path in the script. If we need to move bulk of users / users from a CSV file to different/Target OU then kindly follow this script.
If we need to move AD Objects from one OU to different OU this script will help.
Move Bulk AD users from CSV file to Target / Different OU.
# Import AD Module
import-module ActiveDirectory
# Import CSV
$MoveList = Import-Csv -Path “C:\Temp\File.csv”
# Specify target OU.This is where users will be moved.
$TargetOU = “OU=SVC,OU=NA,DC=ABC,DC=com”
# Import the data from CSV file and assign it to variable
$Imported_csv = Import-Csv -Path “C:\temp\File.csv”
$Imported_csv | ForEach-Object {
# Retrieve DN of User.
$UserDN = (Get-ADUser -Identity $_.Name).distinguishedName
Write-Host ” Moving Accounts ….. ”
# Move user to target OU.
Move-ADObject -Identity $UserDN -TargetPath $TargetOU
}
Write-Host ” Completed move ”
$total = ($MoveList).count
$total
Write-Host “Accounts have been moved succesfully…”

