Hello, @Rising Flight,
Welcome to the Microsoft Q&A platform!
Based on your requirements, I can help guide you through identifying the distribution lists (DLs) in which your mail contacts, mail users, and external users are members in both Exchange On-Premises and Exchange Online environments.
- Connect to Exchange On-Premises: Open the Exchange Management Shell on your Exchange 2016 server and run the following command to get the distribution groups and their members.
Get-DistributionGroup | ForEach-Object { Get-DistributionGroupMember $_.Identity | Select-Object @{Name="GroupName";Expression={$_.Identity}}, Name, RecipientType }
- Connect to Exchange Online: Open the Windows PowerShell and connect to Exchange Online using the following commands.
$UserCredential = Get-Credential
Connect-ExchangeOnline -UserPrincipalName $UserCredential.UserName -ShowProgress $true
Once connected, run the following command to get the distribution groups and their members.
Get-DistributionGroup | ForEach-Object { Get-DistributionGroupMember $_.Identity | Select-Object @{Name="GroupName";Expression={$_.Identity}}, Name, RecipientType }
- Identify Members: The output of these commands will list all distribution groups along with their members, including mail contacts, mail users, and external users. You can export this information to a CSV file for easier analysis.
Get-DistributionGroup | ForEach-Object { Get-DistributionGroupMember $_.Identity | Select-Object @{Name="GroupName";Expression={$_.Identity}}, Name, RecipientType } | Export-Csv -Path "DistributionGroupMembers.csv" -NoTypeInformation
By running these commands, you will be able to identify the distribution lists in both your on-premises and online environments and see which mail contacts, mail users, and external users are members of each list.
If the answer is helpful please click on ACCEPT ANSWER as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.
Thank you for your support and understanding.
Best Wishes,
Alex Zhang