How to Find Out a Cmdlet's Properties

Learn how to use the Get-Member cmdlet to discover what properties, methods, and other items you can use with cmdlets and other objects.

Robert Sheldon

March 26, 2008

1 Min Read
ITPro Today logo in a gray background | ITPro Today

In the Where-Object expressions I use in this lesson, I specify several cmdlet properties, such as Length and Handles. You can use the Get-Member cmdlet to retrieve the members (e.g., properties, methods) of cmdlets and other objects.

Unlike the Get-Command, Get-Content, and Get-Help cmdlets described in "PowerShell 101, Lesson 1" (February 2008, InstantDoc ID 97742), you can't use the Get-Member cmdlet in a statement such as

Get-Member Get-Process

To use Get-Member, you must first specify the object whose members you want to retrieve, pass that object down the pipeline, then specify Get-Member. For example, to view the members available to the Get-Process cmdlet, you'd enter

Get-Process | Get-Member

Figure A shows the members returned by this statement. Notice the AliasProperty entries under the MemberType column. In addition to regular properties, PowerShell supports alias properties and script properties. An alias property (AliasProperty) is an alternative name for a regular property. For example, the Name alias property refers to the ProcessName property. A script property (ScriptProperty) is a property whose value is the output of a script. For example, the Company property generates a script that retrieves the CompanyName property associated with a specific process object.

For more information about the Get-Member cmdlet, see PowerShell's Get-Member Help file. You can find additional information about all the supported member types at technet.microsoft.com/en-us/library/bb978568.aspx.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like