Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

3. The Dime Tour > Inject a GUI into the PowerShell Command Line

Inject a GUI into the PowerShell Command Line

Let’s say I get too much output at the command line from Get-Member. No problem—let’s pipe to a GUI using Out-GridView. Out-GridView comes with PowerShell, ready to go out of the box (see Figure 3-1).

New-Object Net.Webclient | Get-Member | Out-GridView
Injecting a GUI
Figure 3-1. Injecting a GUI

I recommend playing with Out-GridView. It has a filter, which subsets the list as you type. In version 3, it has a –PassThru parameter that lets you select items, which get passed down the pipeline when you click OK.

Out-GridView saves you time and effort when debugging. In a multiline script, you can add a line where you pipe a variable containing an array of objects to it and run the script, and this window pops up. Out-GridView is a great way to inspect what happened.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint