I am trying to use powershell to export a list of all office 365 distribution groups with the character string “XYZ” anywhere in the name of the list and the users/groups that are allowed to send to that distribution group. I am using Office 365 in the cloud that dirsyncs with on-prem AD.
When i run this command, I get (what appears to be) the information mentioned above that I am looking for:
Get-DistributionGroup "*XYZ*" -ResultSize Unlimited | fl name,acceptmessagesonlyfromsendersormembers
When I run THIS command, I get a spreadsheet that contains just a column of numbers:
Get-DistributionGroup "*XYZ*" -ResultSize Unlimited | fl name,acceptmessagesonlyfromsendersormembers | Export-Csv c:tempdist_lists_whocansend.csv -NoTypeInformation -Encoding utf8
I have tried the export command without the encoding and notypeinfo as well. Still produces useless csv with a column of numbers. What am I missing?
Thanks in advance.