Book Image

Microsoft Windows PowerShell 3.0 First Look

By : Adam Driscoll
Book Image

Microsoft Windows PowerShell 3.0 First Look

By: Adam Driscoll

Overview of this book

<p>In an ever growing and changing computer industry, learning how to manage systems effectively is necessary for any administrator. The new features in PowerShell 3.0 extend the already impressive language to support new features that makes working with complex and distributed systems simpler and faster. <br /><br /><i>Microsoft Windows PowerShell 3.0 First Look</i> offers a quick look into the new features available in the most recent version of the language. Quick, to-the-point examples ensure that you will be able to easily understand the new features. <br /><br />Starting with simple syntactical changes all the way through Windows Worflow integration, you will learn through concise feature analysis and simple examples.</p> <p>Throughout this book you will get to grips with changes to the language to aid usability &ndash; making administrators' lives easier. New features will be explored such as Windows Workflow integration and extended WMI capabilities. This book includes a chapter outlining some of the most important new cmdlets and modules found in Windows 8 and Windows Server 8.<br /><br />Microsoft Windows PowerShell 3.0 First Look will provide a jump start for administrators or power users who want to grasp new features, language changes, and cmdlet offerings found in the new version of Microsoft PowerShell.</p>
Table of Contents (14 chapters)
Microsoft Windows PowerShell 3.0 First Look
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
3
Improved Administration
Index

The Show-Command cmdlet


Often the command line can seem like an unfamiliar and daunting area of the operating system, which new users are reluctant to investigate. The lack of a user interface which can be clicked on often outweighs the benefits that short, quick commands can offer. In PowerShell 3.0, Microsoft has added a simple cmdlet to aid in eliminating this stumbling block. This cmdlet is Show-Command.

Running Show-Command without any parameters opens a user interface with a drop-down list of available modules and a list box full of all the cmdlet, aliases, drives, and functions available in those modules. The commands in the list will depend on what is installed on the machine and the list will differ per machine. This is done as follows:

PS C:\> Show-Command

There is a textbox for searching the list available under the Modules drop-down list. If you select one of the commands, drives, or functions, a new pane will open at the bottom of the window, as shown in the following screenshot, which shows all the parameters for the cmdlet and allows you to run, copy, or view the help for a particular item:

You can pass the name of a cmdlet to the Show-Command cmdlet through the Name parameter as well. In this mode, the Show-Command user interface allows for input into the named cmdlet. All the parameters and parameter sets are available for the user to select from and provide input. For this, you can enter the following command:

PS C:\> Show-Command -Name Get-Process

By clicking on the Copy button, a string of text is copied to the clipboard, which is the result of the data entered into the user interface. This text could then be pasted into a script editor or the command line for execution. When clicking on the Run button, the command is executed and the output is not displayed in the user interface, but rather written to the console. Additionally, the size of the resulting window can be adjusted using the Height and Width parameters of the cmdlet.

Another interesting feature of the Show-Command cmdlet is the ? button (shown in the previous screenshot). This button is only available when the Name parameter is specified or a cmdlet is selected from the first view shown previously. Clicking on the button will open a new window with the help for the current command. This is explained by the following command:

PS C:\> Show-Command New-Item

The output is shown in the following screenshot:

Note

Note that the cmdlet Show-Command is blocking the view and you will not be able to interact with the PowerShell console while the window is open.

The Show-Command is an interesting cmdlet to add to an until-now-command line-only shell. The benefit is that it offers a simple visual view of many cmdlets and the respective help. This can help users overcome the shell-shock, which is often associated with opening PowerShell for the first time. Additionally, the cmdlets can be of value to administrators looking to shortcut some of the unnecessary typing that must be done for the cmdlets with lots of parameters. Rather than having to type them out, you can now find yourself tabbing through the Show-Command user interface.