Extract DL group and its member

Get all DL with the name - test

get-distributiongroup -ResultSize Unlimited | where{$_.displayname -like "*test*"} | ft displayname,managedby -AutoSize >> C:\new_folder\Manseau_DL.txt

 

Get all member of the mentioned DL name - DisplayName

Import-csv .\Man_DL.csv |foreach {Get-DistributionGroupMember -identity $_.DisplayName | ft $_.DisplayName,Name,RecipientType -AutoSize} >>C:\New_folder\Man_Owner_Member.txt


Extract members of a list of Distribution List (DL) email addresses and save them to a file along with the DL email address

Get-Content "C:\New_folder\123.txt" | ForEach-Object { $dl = $_; Get-DistributionGroupMember -Identity $dl | Select-Object @{Name='DL Email';Expression={$dl}}, Name, PrimarySmtpAddress } | Export-Csv "C:\New_folder\IT-Group.csv" -NoTypeInformation -Encoding UTF8

No comments: