PowerShell: Object Type, Properties, Methods

By Xah Lee. Date: . Last updated: .

PowerShell commands input (parameter args) and output are all .NET objects. Each .NET object has a type, and members (“member” means properties and methods.). It's critical to understand this to master PowerShell.

Find a Object's Type

To find the object type of a command's output, pipe it to Get-Member. For each object type, Get-Member shows it only once in its output.

Some examples to try:

"abc" | Get-Member
# System.String
Get-ChildItem | Get-Member
# System.IO.DirectoryInfo, System.IO.FileInfo
Get-Date | Get-Member
# System.DateTime
PowerShell show object type 2021-09-09
PowerShell show object type

List Properties of a Given Object Type

Get-Date | Get-Member -MemberType Properties
PowerShell date properties 20210525142244
PowerShell date properties

List Methods of a Given Object Type

Get-Date | Get-Member -MemberType Method
PowerShell date methods 2021-09-09
PowerShell date methods

Show Property Values of a Object

Show all properties and their values of a output object

Get-Date | Select-Object -Property *
PowerShell date properties 20210525141338
PowerShell date properties

Find Object Type via Help

You can find the object type of a command's input parameters and its output in the command's doc. (help name)

Screenshot 2021-09-09 205739 zH7S7
help dir output, showing the types of paramater args.
PowerShell help dir 2021-05-25 ZY62f
help dir, showing types of its input and output.

PowerShell

How-to

Advanced

Script Examples