Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remove an AD group from multiple other AD Groups

Posted on 2016-11-02
4
Medium Priority
?
46 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
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…

722 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