Powershell – Properties and Methods of a cmdlet

Enumerate properties and methods

To list all methods and properties of an object, type:

Get-EventLog –List | Get-Member

To list only properties, type:

Get-EventLog –List | Get-Member –MemberType Properties

To select a specific property or method, type:

Get-Process | Select-Object name,id | Format-List

To select all object except the defined below, type:

Get-Process | Select-Object * -exclude site,container

In the next example we list the last 3 smallest files:

Get-ChildItem c:\windows\*.* | Sort-Object length -descending | Select-Object -last 3


In Depth

Tested With
PowerShell 4.0

Categories: Powershell | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: