Members
Members, as described at the beginning of this chapter, are used to interact with an object.
Members of objects in PowerShell have several possible origins:
- Members are defined by a .NET type.
- Members can be added by PowerShell (essentially by the PowerShell team).
- Members can be added by a user or developer in PowerShell.
The Get-Member
command is one of the most important discovery tools available in PowerShell.
The Get-Member command
The Get-Member
command can be used to view the different members of an object. For example, it can be used to list the members of a Process
object returned by Get-Process
. The $PID
automatic variable holds the process ID of the current PowerShell process:
PS> Get-Process -Id $PID | Get-Member
TypeName: System.Diagnostics.Process
Name MemberType Definition
---- ---------- ----------
Handles AliasProperty Handles = Handlecount
Name ...