Why is -property * needed?

Contrast the two statements below. The behavior is odd to me. If both things are of type Microsoft.ActiveDirectory.Management.ADGroup, then why is it necessary to specify -property * (or just whatever extended property you’re looking for) in order to have that field when referring to an object returned by get-adgroup? I had thought when you selected or sorted by certain properties, that all you were doing was deciding what was output to the screen or filtered or whatever, but it appears that that data is simply not present unless you specify that you want it. Does that mean that what’s returned is not really of the type specified? Or it’s a copy with the nonselected properties set to $null or similar?

get-adgroup “<group name>” | gm
  TypeName: Microsoft.ActiveDirectory.Management.ADGroup

Name             MemberType           Definition
----Â Â Â Â Â Â Â Â Â Â Â Â Â ----------Â Â Â Â Â Â Â Â Â Â Â ----------
Contains         Method               bool Contains(string propertyName)
Equals           Method               bool Equals(System.Object obj)
GetEnumerator    Method               System.Collections.IDictionaryEnumer…
GetHashCode      Method               int GetHashCode()
GetType          Method               type GetType()
ToString         Method               string ToString()
Item             ParameterizedProperty Microsoft.ActiveDirectory.Management…
DistinguishedName Property             System.String DistinguishedName {get…
GroupCategory    Property             System.Nullable1[[Microsoft.ActiveD... GroupScope       Property             System.Nullable1[[Microsoft.ActiveD…
Name             Property             System.String Name {get;}
ObjectClass      Property             System.String ObjectClass {get;set;}
ObjectGUID       Property             System.Nullable`1[[System.Guid, msco…
SamAccountName   Property             System.String SamAccountName {get;set;}
SID              Property             System.Security.Principal.SecurityId…

H$ get-adgroup “<group name>” -property * | gm
  TypeName: Microsoft.ActiveDirectory.Management.ADGroup

Name                           MemberType           Definition
----Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ----------Â Â Â Â Â Â Â Â Â Â Â ----------
Contains                       Method               bool Contains(string p…
Equals                         Method               bool Equals(System.Obj…
GetEnumerator                  Method               System.Collections.IDi…
GetHashCode                    Method               int GetHashCode()
GetType                        Method               type GetType()
ToString                       Method               string ToString()
Item                           ParameterizedProperty Microsoft.ActiveDirect…
CanonicalName                  Property             System.String Canonica…
CN                             Property             System.String CN {get;}
Created                        Property             System.DateTime Create…
createTimeStamp                Property             System.DateTime create…
Deleted                        Property             System.Boolean Deleted…
Description                    Property             System.String Descript…
DisplayName                    Property             System.String DisplayN…
DistinguishedName              Property             System.String Distingu…
dSCorePropagationData          Property             Microsoft.ActiveDirect…
GroupCategory                  Property             System.Nullable`1[[Mic…

<snip many more fields, including memberof, which I was interested in>

It’s a performance thing - same reason you have to specify -filter. The DC by default returns a subset of properties just to make its own life easier. So if you want more than that, you use -Prop. You can use -Prop * to get everything, or specify a list of properties if you want less than everything.

Thanks, that’s interesting. I hadn’t thought about it having to go to the DC for the information.