A useful but short post for a friday afternoon.
I needed to convert around 300 groups from DL\Global to universal as a precursor for some user migrations to another domain in the forest we are part of. I did have the option of having a 1st line engineer go through each one and change the type… but I didnt want to find his body on the pavement at the end of the day so i wrote a script
.
Again, i used the AD CMDlets from PowerGUI ( http://community-downloads.quest.com/powergui/Release/3.1/PowerGUI.3.1.0.2058.msi)
Code is here:
$group=Get-QADGroup -SearchRoot “Domain/OU/” GroupScope Global foreach ($objitem in $group){ Set-qadgroup -Identity $objitem -GroupScope Universal }All its doing is:
- Looking in the OU here: “Domain/OU”
- For global groups: -groupscope Global
- And setting what it finds to universal: Set-qadgroup-Identity $objitem -GroupScope Universal
Nice and easy!
To change what its looking for to Domain local groups, change the groupscope to DomainLocal.
To change what the group type will be set to, change the 2nd groupscope to DomainLocal or Global. Obviously you cant change from universal to global\domain local if you have members outside of your domain.
Any questions, add to the comments. If this has helped, donate me a bitcent or two!