Move AD Group Members to an OU

KB ID 0001266

Problem

I got asked to do this at work this week, PLEASE BE AWARE, moving users about within AD may drastically change the way your ‘User Group Policies’ are being applied. So do some Group Policy Modelling beforehand, to avoid any problems.

Solution

In the example above, I’ve got ten users in a security group called ‘Source-Group‘. For simplicity, they are all in the same source OU as well, (but they don’t have to be). I want to move the users within the Source-Group to the OU Called Target-OU.

Open an administrative PowerShell Window.

(Note: I’m on a domain controller, you might want to load the AD module fist ‘Import-Module ActiveDirectory‘)

Then execute the following command;

[box]Get-ADGroupMember Source-Group -Recursive | Move-ADObject –TargetPath “OU=Target-OU,OU=PNL,DC=pnl,DC=com
[/box]

Related Articles, References, Credits, or External Links

NA