Powershell Convert AD Groups

From Michael's Information Zone
Revision as of 15:32, 31 July 2018 by Michael.mast (talk | contribs) (Created page with "==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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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" $_}}