Joseph Moody
asked on
Move Security Group Members to Another Group
I have a security group with a lot of nested groups. I have another security group with the same number of tested groups. How can I take the members of the nested groups and move them to the new security group.
Ex:
SG_1
London_SG_1
Paris_SG_1
Move members of London and Paris corresponding group:
SG_2
London_SG_2
Paris_SG_2
Ex:
SG_1
London_SG_1
Paris_SG_1
Move members of London and Paris corresponding group:
SG_2
London_SG_2
Paris_SG_2
You can try to achieve this with powershell. This is not tested script, try it and report back:
Import-Module ActiveDirectory
Get-ADGroupMember -Identity London_SG_1 | foreach { Set-ADGroup -Identity London_SG_2 }
Get-ADGroupMember -Identity Paris_SG_1 | foreach { Set-ADGroup -Identity Paris_SG_2 }
ASKER
Thank you both for the replies! This could be a regular occurrence as we try to simplify our group structure.
I modified the second script a little bit to use the quest AD cmdlets. If the script is this:
get-qadgroupmember -identity "SD_Test Group 1" -indirect -type computer | Add-QADGroupMember -identity "SD_Test Group 2"
It will get all of the nested computers from SD_TEST Group 1 but put them in the root of SD_TEST Group 2.
If I add in the foreach statement, I am prompted to type in the computer names.
I modified the second script a little bit to use the quest AD cmdlets. If the script is this:
get-qadgroupmember -identity "SD_Test Group 1" -indirect -type computer | Add-QADGroupMember -identity "SD_Test Group 2"
It will get all of the nested computers from SD_TEST Group 1 but put them in the root of SD_TEST Group 2.
If I add in the foreach statement, I am prompted to type in the computer names.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The script accomplishes my goal! Sharing for others to see.
Open in new window
Or something like this may also be useful to you:
http://adisfun.blogspot.com/2009/06/find-group-members.html