Skip to content
AgileLogics
5 min read

Finding Commands and Help

Prerequisites: Your first commands

PowerShell is designed to teach itself. Three commands answer most "how do I...?" questions.

Get-Command: find commands

Get-Command -Verb Get -Noun Date | Select-Object -ExpandProperty Name
Get-Command *-Csv | Select-Object -ExpandProperty Name | Sort-Object
Get-Date
ConvertFrom-Csv
ConvertTo-Csv
Export-Csv
Import-Csv

Wildcards (*) make it easy to search: Get-Command *service* finds every command about services.

Get-Help: learn a command

# illustrative
Get-Help Get-ChildItem
Get-Help Get-ChildItem -Examples
Get-Help Get-ChildItem -Parameter Filter
Get-Help about_Comparison_Operators
  • -Examples shows ready-to-adapt examples — often the fastest way to learn.
  • about_ topics explain concepts (Get-Help about_* lists them).
  • Run Update-Help once (as administrator on Windows) to download the full help files, or add -Online to open the web version.

Get-Member: explore objects

Every command outputs objects. Get-Member shows their type, properties (data), and methods (actions):

"hello" | Get-Member -MemberType Property

   TypeName: System.String

Name   MemberType Definition
----   ---------- ----------
Length Property   int Length {get;}
"hello" | Get-Member -Name ToUpper, Replace, Split | Select-Object Name, MemberType

Name    MemberType
----    ----------
ToUpper     Method
Replace     Method
Split       Method

Once you know a property or method exists, you can use it: "hello".Length, "hello".ToUpper().

The habit to build: when you meet a new command, pipe its output to Get-Member to see what you can do with it.