Powershell Convert AD Groups

From Michael's Information Zone
Jump to navigation Jump to search

Overview

The title is a little misleading. What I really wanted to do is replicate the existing security groups as domain local, so I can assign users from another domain to the groups. So in the end I converted
SecurityGroup_1
to
new_SecurityGroup_1

.....THIS NEEDS UPDATING.....

Then, to replicate the memebers to the new group.

Get-ADGroup -Filter {GroupScope -eq 'Global'} -SearchBase "OU=SecurityGroups,DC=yourdomain,DC=tld" | foreach {$name=$_ | select -ExpandProperty name;$newname="new_$name"; $_ |  Get-ADGroupMember | foreach {Add-ADGroupMember -Identity "$newname" $_}}