You are currently viewing PowerShell Get-Member Cmdlet

PowerShell Get-Member Cmdlet

PowerShell Get-Member Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed Get-Command cmdlet in PowerShell.

https://cloudaffaire.com/powershell-get-command-cmdlet/

In this blog post, we will discuss Get-Member cmdlet in PowerShell. You can use cmdlet Get-Member to get properties and methods available to a cmdlet. Every cmdlet has some methods available to it which can be used to perform some action using the cmdlet. For instance, Get-Process cmdlet has a method ‘Kill’ which can be used to kill a process. Properties are the information that can be retrieved using the cmdlet. For instance, Get-Process has a property ‘Threads’ which can be used to get thread information of a process.

Using Get-Member cmdlet, you can get all the methods and properties available to a particular cmdlet. Below is the list of members that you can get using Get-Command cmdlet. Not all cmdlet will have all members available to them.

  • AliasProperty: An alias to another member
  • All: All member types
  • CodeMethod: A method defined as a reference to another method
  • CodeProperty: A property defined as a reference to a method
  • Dynamic: All dynamic members (where PowerShell cannot know the type of the member)
  • Event: All events
  • MemberSet: A set of members
  • Method: A method from the BaseObject
  • Methods: All method member types
  • NoteProperty: A property defined by a Name-Value pair
  • ParameterizedProperty: A member that acts like a Property that takes parameters. This is not considered to be a property or a method.
  • Properties: All property member types
  • Property: A property from the BaseObject
  • PropertySet: A set of properties
  • ScriptMethod: A method defined as a script
  • ScriptProperty: A property defined by script language

Get-Member Cmdlet Syntax:

Get-Member Cmdlet Argument List:

  • Force: Adds the intrinsic members and the compiler-generated get_ and set_ methods to the display.
  • InputObject: Specifies the object whose members are retrieved.
  • MemberType: Specifies the member type that this cmdlet gets. The default is All.
  • Name: Specifies the names of one or more properties or methods of the object.
  • Static: Indicates that this cmdlet gets only the static properties and methods of the object.
  • View: Specifies that this cmdlet gets only particular types of properties and methods.

PowerShell Get-Command Cmdlet:

Get All Members Of A Cmdlet In PowerShell:

Get Extended Members Of A Cmdlet In PowerShell:

Get Specific Members Of A Cmdlet In PowerShell:

Get All The Static Members Of A Cmdlet In PowerShell:

Get All Members Of A Cmdlet Based On Name In PowerShell:

Hope you have enjoyed this article. In the next blog post, we will discuss the New-Object cmdlet in PowerShell.

To get more details on PowerShell, kindly follow below official documentation

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about?view=powershell-5.1

 

Leave a Reply