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 7, Working with .NET.

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

  • Base: It shows properties that are derived from a .NET object
  • Adapted: It shows members handled by PowerShell's Adapted Type System (ATS)
  • Extended: It shows members added by PowerShell's Extended Type System (ETS)
Adapted and Extended Type Systems (ATS and ETS)

ATS and ETS systems make it easy to work with object frameworks other than .NET in PowerShell, for example, objects returned by ADSI, COM, WMI, or XML. Each of these frameworks is discussed later in this book.

Microsoft published an article on ATS and ETS in 2011, which is still relevant today: https://blogs.msdn.microsoft.com/besidethepoint/2011/11/22/psobject-and-the-adapted-and-extended-type-systems-ats-and-ets/.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.147.20