Prof. Powershell

A Better View of PowerShell Help

Once you try the ShowWindow parameter in PowerShell 3's Get-Eventlog cmdlet, you'll turn less and less to Get-Help for that quick assist.

I am always telling students and IT Pros I run across in forums, to get in the habit of reading PowerShell help. There is a wealth of valuable information right at your fingertips. The help documentation is structured and well written, a few formatting quibbles aside.

In PowerShell 3 there is a hidden help feature I think you'll like. I say hidden because I think most people won't read the help to discover it! So I'll get you started.

Normally, we run Get-Help for a command, read it, then try it out. If we need to refer to help again we need to re-run the command. Of course, you could open a second console window to run help in. If you have PowerShell 2, you'll need to continue using this technique. But in PowerShell 3 we can display help in a pop-up window using the -ShowWindow parameter:

PS C:\> help get-eventlog -ShowWindow

Fig. 1 shows the complete help in a graphical window, and your prompt has been returned to you. Now you can look through help and still have access to your PowerShell session. Notice the Find field? You can now search through the help for a specific keyword. You don't even have to press Enter. Search starts as soon as you begin typing, and matches are highlighted (see Fig. 2).

ShowWindow's graphical view of PowerShell Help

Figure 1. Call up ShowWindow to get a graphical view of PowerShell Help. (Click image to view larger version.)

 

Keyword searches are highlighted

Figure 2. Keyword searches are highlighted as you begin typing what you're looking for. (Click image to view larger version.)

The help window is also customizable. Click Settings and you should get a window like Fig. 3.

Customization via settings

Figure 3. PowerShell Help can be customized further through these settings.

You can check the different help sections that you wish to see. Click OK to apply the changes. These settings will apply every time you use ShowWindow until you change them again.

The last nice feature, especially for my older students (myself included), is the ability to resize the window and font using the slider. These settings are also saved for the next time you use ShowWindow.

This is an incredibly handy feature because ShowWindow also works with About files:

PS C:\> help about_remote -showwindow

which makes it very easy to find relevant help information. In fact, the parameter should work for anything that has help content, including your own scripts and functions.

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