I was recently looking at Office365/Exchange Online to retrieve Distribution Group membership. This is pretty simple using something like:
Get-DistributionGroupMember -Identity "Marketing"
Not that prior to perforce the following command you need to be already connected to Office365,
see this post.
Retrieving all members of each Distribution Group
Now if I want to retrieve all the Distribution group members, it's bit trickier you'll see. First I started by listing the groups members. My PowerShell instinct made me type
Get-DistributionGroup|Get-DistributionGroupMember but it did not work, see below:
As the error message is stating that this Cmdlet does not accept input :-/
By using
Get-Help on
Get-DistributionGroupMember, we can check the parameters accepting Input:
(Get-Help Get-DistributionGroupMember).parameters.parameter|Select-Object name,parametervalue,pipelineinput