Welcome › Forums › General PowerShell Q&A › Distribution Lists
- This topic has 1 reply, 2 voices, and was last updated 1 month ago by
Participant.
-
AuthorPosts
-
-
December 15, 2020 at 8:36 am #279810
Hi,
Problem
2 companies share 3 domains and should be kept separate most of the time for distribution lists etc.
It is clear we have users from company a in company b’s lists which is wrong.
We are talking about 100’s, if not 1000’s of lists here.I need to be able to search all 3 domains lists (and mail enabled security groups) with @company email address for any @companyb UPN and export the lists with members to review as a few may actually need to be a member.
Once reviewed, then remove the x users.
What’s the best way of doing this?
Cheers
Nick -
December 16, 2020 at 6:16 pm #280371
Hello nenick39,
One way would be to get all Distribution Groups and mail enabled security groups using Get-DistributionGroup. Then foreach group get distribution group members using Get-DistributionGroupMember recursively ( as member of a group could be another group). Then foreach member get his/her email address and apply your filter based on domain name and create custom PS object which will contain couple of properties: DLName, DLEmailAddress, ContainsCompanyAMembers, ContainsCompanyBMembers,ContainsCompanyCMembers.
Add all objects to List and output to file csv/html.
This type of report will be a starting point to understand how many Distribution Group you have to fix/adjust.Hope that helps.
-
This reply was modified 1 month ago by
AndySvints.
-
This reply was modified 1 month ago by
-
-
AuthorPosts
- You must be logged in to reply to this topic.