Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remove multiple users from multiple AD groups

$
0
0

I have a list of over 100 users that I need to remove from all groups that they are a part of (other than the primary group). So I'm trying to make a script that will take each user from my list, delete all the group memberships they have, then do that to the next user and so on.

I think the main problem I am trying to get around is that you can pipeline multiple users to the command Remove-ADPrincipalGroupMembership, but not groups. On the other hand you can pipeline multiple groups to the command Remove-ADGroupMember but not multiple members. Wondering if there is any way to get around this. Any help would be greatly appreciated. Thanks.   

  

Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>