Problem
You want to accomplish a task in PowerShell but don’t know the command or cmdlet to accomplish that task.
Solution
Use the GetCommand cmdlet to search for and investigate commands.
To get the summary information about a specific command, specify the command name as an argument:
GetCommand CommandName To get the detailed information about a specific command, pipe the output of GetCommand to the FormatList cmdlet: GetCommand CommandName | FormatList To search for all commands with a name that contains text, surround the text with asterisk characters:
GetCommand *text* To search for all commands that use the Get verb, supply Get to the Verb parameter: GetCommand Verb Get
To search for all commands that act on a service, supply Service to the Noun parameter:
GetCommand Noun Service
Discussion
One of the benefits that PowerShell provides administrators is the consistency of its command names. All PowerShell commands (called cmdlets) follow a regular VerbNoun pattern. For example: GetProcess, GetEventLog, and SetLocation. The verbs come from a relatively small set of standard verbs and describe what action the cmdlet takes. The nouns are spe cific to the cmdlet and describe what the cmdlet acts on.
Knowing this philosophy, you can easily learn to work with groups of cmdlets. If you want to start a service on the local machine, the standard verb for that is Start.A good guess would be to first try StartService (which in this case would be correct), but typing GetCommand Verb Start would also be an effective way to see what things you can start. Going the other way, you can see what actions are supported on services by typing GetCommand Noun Service.
The GetCommand cmdlet is one of the three commands you will use most commonly as you explore Windows PowerShell. The other two commands are GetHelp and GetMember.
There is one important point when it comes to looking for a PowerShell command to accomplish a task. Many times, that PowerShell command does not exist, because the task is best accomplished the same way it always was—shutdown.exe to reboot a machine, netstat.exe to list protocol statistics and current TCP/IP network connections, and many more.
For more information about the GetCommand cmdlet, type GetHelp GetCommand.