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

Using CSV remove users from all Distribution Groups

$
0
0

Presently, I use the following to remove a named user from all distribution groups:

Get-DistributionGroup | Remove-DistributionGroupMember -Member username@domain.com

The problem with the above is that it attempts to remove the user from all DG's (not just the ones for which they are a member).  This is inefficient but gets the job done.

I'm consulting this forum because I want to perform the above against a list of users in a CSV.

Use case: Batches of temporary employees sometimes leave organization and I want to process in bulk.

All help is appreciated!  Thanks in advance,

Sean-Colin


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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