Posted in
Exchange Server,
Windows Powershell |
No Comment | 1,831 views | 26/11/2014 11:01
I looked for a powershell command to get distribution groups and members in one command but it seems it’s not possible.
So I used an expression to merge them. You can check my following code:
1
| Get-DistributionGroup | Select Name, @{label="Members";expression={($_ | Get-DistributionGroupMember).Name}} |
Get-DistributionGroup | Select Name, @{label="Members";expression={($_ | Get-DistributionGroupMember).Name}}
Output will be like:
Name Members
—- ——-
Customer Services {Yusuf Ozturk, Bertan Demirci}
You can see all other fields by using:
1
| Get-DistributionGroup | Select *, @{label="Members";expression={($_ | Get-DistributionGroupMember).Name}} |
Get-DistributionGroup | Select *, @{label="Members";expression={($_ | Get-DistributionGroupMember).Name}}
You can also add other field by using additional expressions.