Get-Member tutorial: inspect PowerShell objects
Find the property or method a command actually returns before building a filter around it.
Documentation: Microsoft Learn
Overview
You want the processes consuming the most memory, but you do not know whether the property is called Memory, WS or WorkingSet64. Inspect one result with Get-Process | Get-Member, then read the property names rather than guessing from the column headings.
Get-Member -MemberType Properties narrows the list to data you can select or compare. Methods are operations on the object and can have side effects; a method name appearing in the list is not a reason to call it.
For collections, piped input normally exposes the members of the individual items. Get-Member -InputObject $items instead inspects the collection object itself. If your lookup returned no items, piping it to Get-Member cannot reveal a type that was never returned.
A remoting result may be deserialized. Its properties can remain useful while methods from the original live object are absent. Inspect the returned type in the session where you plan to use it.
What happens
Run the process example and look for WorkingSet64. Then use it in a Select-Object or Sort-Object pipeline. In real PowerShell, inspect Get-Process | Select-Object -First 1 | Format-List * to see values as well as names.
Worth remembering
Get-Member describes an object; it does not retrieve missing data or preserve the input for the next stage.
Primary documentation
Try it
Browser simulation · fictional data; no changes to your computer.
Follow the objects
Run the command to inspect each stage.
Reports the type and full member list of a process object.
Show reference output
Sample output · fictional data, shaped like the real thing
Name MemberType ------------ ---------- CPU Property Id Property Name Property ProcessName Property WorkingSet Property WorkingSet64 Property WS Property
Practise this
Discover service properties
Use Get-Member to list the available service properties.
The sandbox is visible now. Sign in with Google only when you run or check a task; commands and temporary files are discarded when you leave.
Run a command to inspect its result.