Share This Post

Get-Command cmdlet in PowerShell

If you play with PowerShell for a while, you probably use get-help and get-member comdlets a lot. Here I want to mention another very handy cmdlet, get-command

In PowerShell console, type get-command | out-file cmdlets.xls

This will create a spreadsheet which contains all the PowerShell cmdlets. As it stands now for CTP 2.0, it has 155 cmdlets.

Let’s say you want to use a cmdlet but you don’t know the exact verb-noun combination, but you do remember the verb is "export", you can type the below

PS C:\Users\Ying> get-command -verb export

CommandType Name Definition
———– —- ———-
Cmdlet Export-Alias Export-Alias [-Path] <String> [[-Name] <String[]…
Cmdlet Export-Clixml Export-Clixml [-Path] <String> [-Depth <Int32>] …
Cmdlet Export-Console Export-Console [[-Path] <String>] [-Force] [-NoC…
Cmdlet Export-Csv Export-Csv [-Path] <String> -InputObject <PSObje…

Similarly, if you know the noun is "object", you can do this:

PS C:\Users\Ying> get-command -noun object

CommandType Name Definition
———– —- ———-
Cmdlet Compare-Object Compare-Object [-ReferenceObject] <PSObject[]> […
Cmdlet ForEach-Object ForEach-Object [-Process] <ScriptBlock[]> [-Inpu…
Cmdlet Group-Object Group-Object [[-Property] <Object[]>] [-NoElemen…
Cmdlet Measure-Object Measure-Object [[-Property] <String[]>] [-InputO…
Cmdlet New-Object New-Object [-TypeName] <String> [[-ArgumentList]…
Cmdlet Select-Object Select-Object [[-Property] <Object[]>] [-InputOb…
Cmdlet Sort-Object Sort-Object [[-Property] <Object[]>] [-Descendin…
Cmdlet Tee-Object Tee-Object [-FilePath] <String> [-InputObject <P…
Cmdlet Where-Object Where-Object [-FilterScript] <ScriptBlock> [-Inp…

It’s indeed very handy, isn’t it?

Share This Post

Ying Li obtained a Master degree of Medicine in China and worked in the medical field before he came to the states in 1996. He made the career switch from troubleshooting people to troubleshooting computers after he came to the states. Not entirely a surprise there, if you know that his second preference for college is Mathematics. Ying is two times Admin Framework MVP awardee (2007-2008).His previous employment experience in the US includes UUNET, MCI WorldCom. MMC (Marsh & McLennan Companies), Merrill Lynch. He is currently employed by Related Companies as a Senior Infrastructure Engineer. He is proficient in virtually all Microsoft products (Office/Back office). His craving for efficiency naturally leads him to scripting, automation and before you know it, PowerShell! He is currently a MCSE (NT4, 2000, 2003) and MCITP Server Administrator. Ying enjoys wines and love to travel. His non work related passion is to advocate Health Living!

Leave a Reply