The Get-Member command

The Get-Member command is used to view the different members of an object. For example, it can be used to list all of the members of a process object (returned by Get-Process):

Get-Process -Id $PID | Get-Member 

Get-Member offers filters using its parameters (MemberType, Static, and View). For example, if we wished to view only the properties of the PowerShell process, we might run the following:

Get-Process -Id $PID | Get-Member -MemberType Property 

The Static parameter will be covered in Chapter 8, Working with .NET.

The View parameter is set to all by default. It has three additional values:

  • Base: It shows properties which are derived from a .NET object
  • Adapted: It shows members handled by PowerShell's Adapted ...

Get Mastering Windows PowerShell Scripting - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.