Solved

Remove an AD group from multiple other AD Groups

Posted on 2016-11-02
4
26 Views
Last Modified: 2016-11-02
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 !!
0
Comment
Question by:MilesLogan
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41871186
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
 
LVL 6

Expert Comment

by:gilnov
ID: 41871222
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
 
LVL 6

Expert Comment

by:gilnov
ID: 41871226
Unless this is a homework assignment and we just helped you cheat!
0
 
LVL 2

Author Closing Comment

by:MilesLogan
ID: 41871539
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Set OWA language and time zone in Exchange for individuals, all users or per database.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now