Get-Member

Enumerate the properties of an object.

Syntax
      Get-Member [ [-name] string[] ]  [-inputObject psobject]
        [-memberType memberType  [-static] [CommonParameters]
Key
   -name 
        The member name(s) to retrieve information about.

   -inputObject 
        The objects to retrieve information about.
		
   -memberType 
        The type of members to retrieve information about. 
        Valid member types are: AliasProperty, CodeProperty,
        Property, NoteProperty, ScriptProperty, Properties,
        PropertySet, Method, CodeMethod, ScriptMethod, Methods,
        ParameterizedProperty, MemberSet, and All.

   -static 
        Retrieve static properties and methods.
		
CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Examples

Display the properties of a Process object: (.Net Framework Class Library System.Diagnostics.Process)

PS C:\>get-process | get-member -MemberType property

Display the properties of an Alias object:

PS C:\>get-alias | get-member

or using a variable:
PS C:\>$alias = get-alias
$alias | get-member

Display the properties of the container object, a System.Object array:

PS C:\>$alias = get-alias
get-member -inputobject $alias

Piping a command into get-member twice will display the properties of the parent object: Powershell.Commands.MemberDefinition:

PS C:\>get-process | get-member | get-member

Pipelining a container object, will run get-member for each element in the container.
Using the -InputObject parameter, will run get-member for the container object itself.
Prefixing the pipelined input with a comma will also force get-member to run against the container object:
PS C:\>,$alias | get-member

"I wouldn't join any club that would have me as a member" - Groucho Marks (describing Hillcrest Country Club)

Related Powershell Commands:

Add-Member - Add a member to an instance of a PowerShell object
Get-Help - Open the help file
Get-Command - Retrieve basic information about a command
Get-PSDrive - Get drive information (DriveInfo)



Back to the Top

Simon Sheppard
SS64.com