PowerTip: Find Array Members with Get-Member in PowerShell
Summary: Learn to find members of an array with the Get-Member cmdlet in Windows PowerShell.
I have an array of numbers: 1,2,3,4,5 that I assigned to variable $a. When I pipe it to Get-Member: $a | gm,
all I see are members for int32. How can I find the members of an array by using Get-Member?
There are two ways to do this:
1. Use the uniary operator ( , ) in front of the array prior to piping it to Get-Member:
PS C:\> $a = 1,2,3,4,5
PS C:\> ,$a | get-member
2. Use the –InputObject parameter with Get-Member:
Get-Member -InputObject $a