Remove an AD group from multiple other AD Groups

Hi EE

Does anyone have a script to share that will remove an AD group from being a MemberOf other AD groups ?
I want to add to a text file the groups that the group should be removed from .

thanks !!
LVL 2
MilesLoganAsked:
Who is Participating?
 
SubsunConnect With a Mentor Commented:
To remove GroupA from all groups listed in text file..
GC C:\temp\Groups.txt | % {Remove-ADgroupmember -Identity $_ -Member "GroupA"}

Open in new window

Following code will remove all groups listed in the text file from GroupA
$Groups = GC C:\temp\Groups.txt
Remove-ADgroupmember -Identity "GroupA" -Member $Groups

Open in new window

0
 
gilnovSystems AdministratorCommented:
I'm confused. Why can't you just go to the "Member Of" tab on the subject group and remove the memberships you don't want there?
0
 
gilnovSystems AdministratorCommented:
Unless this is a homework assignment and we just helped you cheat!
0
 
MilesLoganAuthor Commented:
Thank You Subsun ..

oh an its not cheating ... EE is like having co workers that can help in a bind ..

appreciate your help Subsun .
0
All Courses

From novice to tech pro — start learning today.