Get-Command can help determine the best cmdlet for a task. To find cmdlets, follow the steps below:
- At the Terminal, type pwsh to invoke PowerShell.
- Enter Get-Command to get a list of all cmdlets available in PowerShell. The number of cmdlets returned would change based on when you last updated PowerShell and the modules you've loaded.
PS> Get-Command
This may not be particularly useful—what would you do with a list of commands if you were looking for something to list out the currently-running processes?
- A process is a noun. We want a list of cmdlets that work on processes. At the prompt, type:
PS> Get-Command -Noun Process
Note that in PowerShell, the noun is in the singular form. Therefore, it's Process and not Processes.
- If you would like to further narrow down the list of cmdlets returned, add the verb as well.
PS> Get-Command -Verb Get -Noun Process
- If you're feeling lazy, or unsure of the exact conventions, you could even use the wildcard.
PS> Get-Command -Noun Proc*
- If you'd rather not write so much, and you're almost sure you know the partial cmdlet, you can straight away use wildcard search.
- If you know the name of the module which contains the cmdlet, you can even use the Module parameter when invoking Get-Command.
PS> Get-Command -Noun Process -Module Microsoft.PowerShell.Management