Open utterances-bot opened 2 years ago
Can you provide additional code to export output results to an csv file. Thanks
@ImStillWorking You can just pipe the code to Export-CSV myfile.csv
(Get-DistributionGroup).identity | ForEach-Object{
$DistributionGroupName = $_
Get-DistributionGroupMember -Identity $_ | ForEach-Object{
[PSCustomObject]@{
DistributionGroup = $DistributionGroupName
MemberName = $_.Name
#Other recipient properties here
}
}
}| Export-CSV myfile.csv
PowerShell/Office 365 - Get the distribution groups membership - LazyWinAdmin
I was recently looking at Office365/Exchange Online to retrieve Distribution Group membership. This is pretty simple using something like: Get-DistributionGroupMember -Identity "Marketing"
https://lazywinadmin.github.io/2015/08/powershello365-get-distribution-groups.html