Created
June 13, 2018 14:48
-
-
Save danielchc/dac80058e3853529190e313db7cd008b to your computer and use it in GitHub Desktop.
Lists users from each Distribution List (DL)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$FileName='DistributionLists.csv') | |
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 2>$nul | |
$groups=ForEach ($i in Get-DistributionGroup){ | |
Get-DistributionGroupMember $i | Select @{n='DistributionName';e={$i.Name}},@{n='DistributionMail';e={$i.PrimarySmtpAddress}},Name,PrimarySmtpAddress | |
} | |
$groups |Export-CSV $FileName -NoTypeInformation -Encoding UTF8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment