Show-Command PowerShell 3.0
Show-Command is a new way for researching the parameters and syntax of other PowerShell cmdlets. In this tutorial you will see how to filter using ‘Modules’, then examine the cmdlet properties in a ‘Form’.
♦
Show-Command Syntax
I see this as a learning tool to compliment Get-Help. The idea behind Show-Command is to provide a sand box for testing another PowerShell cmdlet; I have chosen to examine the parameters for Get-Process, but you could experiment with any cmdlet.
# Windows PowerShell 3.0 New Cmdlet
Show-Command Get-Process
Note 1: The rhythm is:
Show-Command PowerShell cmdlet.
Results of Show-Command
The idea is that you can test a cmdlet’s parameters, for example, Id, or computer name.
Note 2: Observe how you can ‘Run’ the experiment, or if that button is greyed out, you can ‘Copy’, then paste from the form into the PowerShell GUI.
Note 3: It’s worth running Show-Command just to remind oneself of the ‘Common Parameters’.
Note 4: If you are experimenting for real I recommend opening the corresponding interface, in this case Task Manager; then I compare the Show-Command form with the Task Manager Process tab.
Show-Command with Get-ChildItem
Here is another example which shows how you can learn more about the parameters of a cmdlet, this time it’s gci (Get-ChildItem).
# PowerShell 3.0 Script
Show-Command Get-ChildItem
Note 5: See from the screenshot how the PowerShell Show-Command helps reveal parameters such as -recurse and -force. If you do this for real scroll up (or down) to see more options.
Note 6: Remember that you have the option to ‘Run’, or ‘Copy’. If you choose copy then I suggest you open another ‘New’ script page and paste, that’s the easiest way to see what Show-Command has produced.
The above example would paste: Get-ChildItem -Path C:\CP -Recurse
(Assuming you added a Path parameter in addition to the ticking the Recurse box). For more information see the PowerShell 3.0 ISE.
Guy Recommends: Free WMI Monitor for PowerShell
Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft’s operating systems. Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your PowerShell scripts.
Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory, or Exchange Server. Give this WMI monitor a try – it’s free.
Download your free copy of WMI Monitor
Researching PowerShell’s Show-Command Parameters
As with other cmdlets, calling for Get-help always reveals at least one interesting parameter. In this case it was -ErrorPopUp that attracted my attention.
# PowerShell Show-Command parameters
Show-Command Get-ChildItem -full
Note: I discovered other parameters to control the ISE, such as -NoCommonParameters, and -Width.
How to Launch Windows PowerShell ISE
Here is an easy way to get started from the Microsoft Metro UI.
- From anywhere in the Metro UI if you press the ‘p’ key, you should see a list of the programs and Apps beginning with ‘p’.
- At this point you could ‘Pin’ the ‘Windows PowerShell ISE’ to the main screen by right-clicking and selecting ‘Pin’ at the bottom right of the screen.
- I like to drag the PowerShell ISE tile to the left of my screen because it’s one of the most important Windows 8 Tiles that use.
- To install Windows 8 with PowerShell 3.0 see here.
Auto-Complete In PowerShell 3.0?
Auto-Complete is a nifty command to learn more about Windows PowerShell. As you begin to type a cmdlet, say ‘Show-‘ you see a pick-List of likely nouns to append to your verb.
Microsoft also provide a useful way of grouping cmdlets:
Guy Recommends: A Free Trial of the Network Performance Monitor (NPM) v11.5
SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
Download a free trial of Solarwinds’ Network Performance Monitor
Investigate Three More PowerShell Techniques
- Get-Member to list the properties.
- Get-Help to find out more about parameters.
- This is How to Discover More PowerShell 3.0 Cmdlets
This is How to Discover More PowerShell 3.0 Cmdlets
Note how this PowerShell script sorts the ‘CommandType’ in descending order, and the ‘Name’ in ascending order.
# Short PowerShell 3.0 Script
Clear-Host
$PSSC = Get-Command | `
Where-object {$_.CommandType -eq ‘Alias’ -or $_.CommandType -eq ‘Cmdlet’}
$PSSC | Sort-Object -property `
@{Expression="CommandType";Descending=$true}, `
@{Expression="Name";Descending=$false} | FT CommandType, Name -auto
Note 7: Much to my surprise, I discovered these two cmdlets: Show-EventLog and Show-ControlPanelItem.
Summary of PowerShell 3.0’s Show-Command
This page explains how to employ Show-Command, which is one of PowerShell 3.0’s new cmdlets. Beginners may find the results a little perplexing and advanced PowerShell users may have better ways of extracting the same information; but for intermediates, I think that PowerShell’s Show-Command is ideal for discovering more about other cmdlets.
If you like this page then please share it with your friends
See more Microsoft PowerShell v 3.0
• PowerShell 3.0 • What’s New in PowerShell 3.0 • PowerShell 3.0 Foreach-Object
• PowerShell Show-Command • Out-GridView -PassThru • PowerShell Ordered Hash Tables
• PowerShell Home • PowerShell 3.0 Get-ChildItem • PowerShell 3 -NotIn • PowerShell 3.0 Where