PowerShell Get-Command
Table of Contents
Get-Command
Get-Command is used to retrieve information about available cmdlets, functions, aliases, and scripts. It’s a handy tool when exploring PowerShell’s capabilities.
-Verb
-Verb Filters commands based on their verb (e.g., Get, Set, Remove). PowerShell cmdlets follow a verb-noun naming convention.
Example Usage - Find all commands with the verb ‘Get’
Get-Command -Verb Get
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Get-Process Microsoft.PowerShell.Management
Cmdlet Get-Service Microsoft.PowerShell.Management
Cmdlet Get-Item Microsoft.PowerShell.Management
-Noun
-Noun: Filters commands by noun, which represents the subject of the cmdlet (e.g., Process, Item, Service).
Example Usage - Find all commands related to services
Get-Command -Noun Service
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Get-Service Microsoft.PowerShell.Management
Cmdlet New-Service Microsoft.PowerShell.Management
Cmdlet Start-Service Microsoft.PowerShell.Management
Cmdlet Stop-Service Microsoft.PowerShell.Management
-Verb and -Noun
Using Them Together: You can use both -Verb and -Noun to find commands that match specific criteria.
Example Usage - Find commands that have both ‘Get’ as the verb and ‘Service’ as the noun
Get-Command -Verb Get -Noun Service
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Get-Service Microsoft.PowerShell.Management