If we want to move AD objects (E.g users) across domains or Same Domain . (Note: This Command doesn’t work across forsest)
Let me Move some 3 Users from One OU to Different OU.
In this Below example – am listing Objects like user where name starts with GG ,Specifying the Target path .
(Note : You can get the Target path from the distinguishedname attribute of the OU)
PS — On a Domain Controller run Windows Server 2012 R2
Import-Module ActiveDirectory
Get-ADObject -Filter {(Objectclass -like “user”) -and (name -like “GG*”)} | Move-ADObject -TargetPath “OU=IT,DC=testcareexchange,DC=biz” -Verbose