liveBook · Manning

Get-Command

As explained in Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS

Get-Command is a PowerShell cmdlet that retrieves commands matching specified names, verbs, nouns, or command types.

Get-Command helps you discover PowerShell commands directly, especially when you remember part of a name but not the exact command. Its alias is gcm. section 3.4

Use wildcards to search command names. For example, gcm *get* lists commands containing get, although results can include external commands such as wget. section 3.4

Narrow the search by using command verbs, nouns, types, or modules:

  • Get-Command -Noun *event* finds commands dealing with events. section 3.4
  • Get-Command -Verb Get lists commands whose verb is Get. section 3.4
  • Get-Command *event* -Type cmdlet limits matching results to cmdlets. section 3.4
  • Get-Command -Module PSReadLine lists commands supplied by a named module. section 12.8

Find commands before reading their help

Try Get-Command -Noun file,printer, Get-Command -Verb set -Noun psbreakpoint, or Get-Command Get-* -Module PSReadLine. After narrowing the list, use Help with -Example or -Full to learn how to run a command. section 3.9 section 7.6 section 12.8

       Name                 Category ModuleName
 
       Get-Event            Cmdlet   Microsoft.PowerShell.Utility
       Get-EventSubscriber  Cmdlet   Microsoft.PowerShell.Utility
       New-Event            Cmdlet   Microsoft.PowerShell.Utility
       Register-EngineEvent Cmdlet   Microsoft.PowerShell.Utility
       Register-ObjectEvent Cmdlet   Microsoft.PowerShell.Utility
       Remove-Event         Cmdlet   Microsoft.PowerShell.Utility
       Unregister-Event     Cmdlet   Microsoft.PowerShell.Utility
       Wait-Event           Cmdlet   Microsoft.PowerShell.Utility

Browse an example result set showing event-related cmdlets, including Get-Event, New-Event, and Register-ObjectEvent. section 3.4

How Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS covers it

How deep it goes
Explains name, verb, noun, type, and module filtering with runnable examples, but stops short of command implementation internals.
Examples
Uses event, file, printer, breakpoint, PSReadLine, and process searches as practical discovery exercises.
What it assumes
Assumes basic PowerShell command syntax while reinforcing verb-noun names, parameters, spaces, dashes, and aliases.
What you can do after
Evaluate command choices by narrowing results, then read targeted examples or full help for the selected command.
How it connects
Connects command discovery with cmdlets, aliases, wildcards, parameters, modules, and the Help system.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS. The section links point to the parts of the book it draws on.