Finding PowerShell Commands

by Feb 24, 2021

Get-Command can help you find PowerShell commands for a given task but this cmdlet can only search for keywords in command names and parameters.

A more sophisticated search command can be installed from the PowerShell Gallery:

Install-Module -Name PSCommandDiscovery -Scope CurrentUser -Verbose

Find-PowerShellCommand takes a keyword and returns all commands related to this keyword. It searches for your keyword in command names, command parameters, but also in returned object properties. If the found command type is a compiled application, the command also returns the type of command (GUI or console-based command).

PS> Find-PowerShellCommand -Keyword user -CommandType Function,Cmdlet,Application

Command                                   MatchType   Member
-------                                   ---------   ------
Add-WinADUserGroups                       CommandName
Get-ComputerInfo                          Property    [string] CsUserName (read/write)
Get-ComputerInfo                          Property    [Nullable`1[[System.UInt32, Syst
Get-ComputerInfo                          Property    [Nullable`1[[System.UInt32, Syst
Get-ComputerInfo                          Property    [string] OsRegisteredUser (read/
Get-ComputerInfo                          Property    [Nullable`1[[Microsoft.PowerShel
Get-Credential                            Property    [string] UserName (readonly)
Get-Culture                               Property    [bool] UseUserOverride (readonly)
Get-LocalUser                             CommandName
Get-PnPAADUser                            CommandName
Get-PnPTeamsUser                          CommandName
Get-PnPUser                               CommandName
Get-PnPUserOneDriveQuota                  CommandName
Get-PnPUserProfileProperty                CommandName
Get-Process                               Property    [timespan] UserProcessorTime (re
Get-UICulture                             Property    [bool] UseUserOverride (readonly)
DevModeRunAsUserConfig.msc                Command     .msc: DevModeRunAsUserConfig (Un
DsmUserTask.exe                           Command     .exe: DsmUserTask (x64) [Gui] 10
quser.exe                                 Command     .exe: quser (x64) [Console] 10.0
(...)

The “MatchType” property reports the kind of match. Commands can be found based on a keyword match in command name, parameter name, or any of the property names of returned objects.

See https://github.com/TobiasPSP/PsCommandDiscovery for additional samples, source code, and description of all parameters.


Twitter This Tip! ReTweet this Tip!