Solved

Remove an AD group from multiple other AD Groups

Posted on 2016-11-02
4
41 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 7

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 7

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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