Run the following command:
Get-ADUser -properties MemberOf | select MemberOf | Format-List *
results in something like
Use Select-Object's -ExpandProperty switch:
Get-ADUser -Properties MemberOf | select -ExpandProperty MemberOf
When you use Select-Object to filter for certain properties, it returns a PSCustomObject containing the specified properties of the object selected (or an array of PSCustomObjects, if multiple objects are selected). With -ExpandProperty, which may be used with only a single property, for each object selected it returns the object contained in the specified property.
So, with | select MemberOf
, what's being returned is a PSCustomObject whose sole property is the MemberOf property of the ADUser object returned by Get-ADUser, displayed in list format (in the same style as it would display the results if you were listing multiple properties of the object).
With | select -ExpandProperty MemberOf
, what's being returned is the ADPropertyCollection object which is contained in the MemberOf property (a collection of strings representing the DNs of the members), and that's the object that's displayed in list format.
BTW, I removed the | Format-List *
because it's superfluous in this case.