Great feature for the people who keep forgetting what parameters are available.
It also gives you the option to run the selected command or to copy the command and paste it in the shell.
Jeffrey Hicks from MCPMag.com wrote a nice article about it:
Show Me State: PowerShell 3.0's Show-Command Gets GUI
PowerShell 3.0 sports a cool new feature, the Show-Command cmdlet, which provides a graphical way of looking at all cmdlets and functions at your disposal. Here's a graphic look at it.
One of the more exciting new features in PowerShell 3.0 is the Show-Command cmdlet. This tool offers a graphical interface for working with cmdlets and modules. It is a graphical tool, but you can launch it from the PowerShell prompt as well as view its help:
PS C:\> help show-command
If you run Show-Command at a prompt without specifying a command name, the graphical display will list cmdlets and functions from all modules, regardless of whether or not they are loaded into the current shell. Another new feature of PowerShell 3.0 is that you can run any command and PowerShell will dynamically load the necessary module.
In the tool you can enter a command name, or filter by selecting a module from the drop down list, as I did in Fig. 1.
Let's say you wanted to know more about Get-Eventlog. Click on it. Show-Command will display a form for all of its parameters, as shown in Fig. 2.
|
Figure 2. Here's what you need to know about Get-Eventlog, courtesy of Show-Command; each tab is a parameter set. (Click image to view larger version.)
|
The different tabs correspond to the different parameter sets. What I think many people will like is that you can enter in parameter values. I'll enter in a few in Fig. 3.
I can click the Run button and the composed command will execute in the shell. Or I can click Copy and PowerShell will generate the command expression which I can copy into the shell, the ISE or anywhere like this article:
Get-EventLog -LogName "System" -After 1/1/2012 -ComputerName "COREDC01" -EntryType "Error"
How handy is that! There is also a variation on this tool in the new Integrated Scripting Editor (ISE). It opens by default when you launch the ISE as you can see in Fig. 4.
It works essentially the same way. If you select a command that is in a module you haven't loaded, you'll most likely see a button to Show Details. Click it and then you'll have the same entry form as shown earlier.
Again, you can Run or Copy the command. In the ISE there is also an Insert button which should insert the command into the current script. As I write this, PowerShell v3 is still in beta and there is a bug where this doesn't work. But the intention is that you can use Show-Command to build command expressions and insert them into your script. I think this will change the way many IT pros approach PowerShell scripting.
If you'd like to try this out for yourself, grab a copy of the Windows 8 preview or the Windows Management Framework 3.0 beta from Microsoft, open up a PowerShell or ISE session and "show" away.
Note: Some of the information in this article is based on the latest publicly available pre-release version of PowerShell 3.0. Expect some changes with the final, shipping release.
No comments:
Post a Comment