Prof. Powershell

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.

Run Show-Command from a prompt and you'll be able to enter a command name or filter by selecting a module from a drop down list.

Figure 1. Run Show-Command from a prompt and you'll be able to enter a command name or filter by selecting a module from a drop down list. (Click image to view larger version.)

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.

Here's what you need to know about Get-Eventlog, courtesy of Show-Command.

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.

You can choose or type the parameter values you want, such as I'm doing here for Get-Eventlog.

Figure 3. You can choose or type the parameter values you want, such as I'm doing here for Get-Eventlog. (Click image to view larger version.)

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.

Show-Command, the ISE version.

Figure 4. Show-Command, the ISE version. (Click image to view larger version.)

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.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular

Upcoming Training Events

0 AM
Live! 360 Orlando
November 17-22, 2024
TechMentor @ Microsoft HQ
August 11-15, 2025