Get-Member returns an object name and member list for each type of object it contains.
PS C:\src\t\getlast> $a = @(1,'now')
PS C:\src\t\getlast> $a | gm
TypeName: System.Int32
...
TypeName: System.String
...
Is there a way to get the object name and member list for the array object itself? Creating an array containing an array and a different type is the only way I have found to get a list of members for an array object.
PS C:\src\t\getlast> $a = @(@(1),'now')
PS C:\src\t\getlast> $a.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
PS C:\src\t\getlast> $a | gm
TypeName: System.Object[]
...
TypeName: System.String
...
Get-Member -InputObject $a
Essentially, feed Get-Member the whole object as using the pipeline pipes it element by element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With