Last night… was shock to see some of my groups are been shifted \ landed up into wrong OUs in my Active Directory.
I have approx 300 over OUs and there are just so many groups to be moved back to their respective OU…
This is where powershell cmdlet comes in handle! Imagine using vbscripts… Yes, we can do it. But the script needs to be modify and it is quite lengthy~
In my environment, I am using Quest AD Cmdlet… I find it easier to use. Just imagine, for vbscript, you will need to comb through the whole AD for the user-group and compare before you know where to move it to. For powershell, you just need one line as there is a ready cmdlet that does what I want!!
Here is the command I use..
Get-QADObject <Group Name> -type Group | Move-QADObject –to <FQDN of Domain>/OU_01_LEVEL/OU_02_LEVEL
<Group Name> – just state the group you want to move.
For my case, I am looking for group that starts with site code “ABCD_”
My Command will be:
Get-QADObject ABCD`_* -type Group | Move-QADObject –to tanchee.panda.local/OU_01_LEVEL/OU_02_LEVEL
This command will search the whole domain for group that is like “ABCD_Tan”, “ABCD_Chee” and “ABCD_PAN” and move the Group to the target site “tanchee.panda.local/OU_01_LEVEL/OU_02_LEVEL”
So… is there anything stopping you as a AD administrator from learning powershell? STOP THINKING AND GIVING YOURSELF REASON… START LEARNING AND START PLAYING WITH POWERSHELL!
Tested working in 2008 R2 and 2003 AD environment.
Link to download quest powershell cmdlet (free) for active directory.