'How to Select columns in the output of PowerShell command (Microsoft Compliance Center Roles report)

I would like to get the list of Compliance Roles members via PowerShell. I figured out command to get the list of all members:

Get-RoleGroup | ForEach {Get-RoleGroupMember $_.Identity | Select Name, Alias} | export-csv "C:\Temp\Output.csv" -NoTypeInformation

By this command I'm getting only list of the members without any column which would say, member of which RoleGroup particular user is, so here my question comes...

How can I include some columns from the result of Get-RoleGroup command into the output csv file? Is there any better way how to get list of all RoleGroup members assigned with any role from from Microsoft's Compliance Center?

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source