Created
July 17, 2019 23:08
-
-
Save tostka/45be4596531bf449c617ebd295806894 to your computer and use it in GitHub Desktop.
Move ADUser to non-replicated OU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# populate the DistName string below with a DN pointed at the target unreplicated OU | |
$tOU=get-adobject -Identity 'OU=Workspace,DC=SUBDOMAIN,DC=ad,DC=DOMAIN,DC=com' ; | |
# store the original ADUser object parentOU (split DN and build the parent OU) | |
$origOU=($adu.distinguishedname.split(",") | select -skip 1) -join "," ; | |
# move the ADUser object to the $tOU, note -whatif needs to be removed to execute | |
Move-ADObject -Identity $adu.ObjectGUID.guid -TargetPath $tOU.DistinguishedName -whatif ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment