Out-GridView to present and demo results more easily.

Background:

 I recently had the opportunity to see a presentation involving FabTools (PowerShell Module for Fabric)
The audience was PowerShell-light, and it was the end of long week, so even a small interruption in the flow had potential to lose traction.

So it made me think about a small way that live demos can be streamlined for both presenters and viewers.


Using | Out-GridView for presenting, demonstrating, and sharing.

When we're sharing the results of our actions in PowerShell we have the advantage of knowing what we're looking for and what we're looking at. Our audience however may be deep in unfamiliar territory. Out-GridView can be a visual communication tool that helps them to catch up.

Because Out-GridView is an output tool and not a scripting tool it is easily forgotten (or unknown) to people who are very competent in PowerShell.
Generally I use this cmdlet when I'm sharing information with others (either looking at the same screen, or doing a quick paste into excel), and thought that it might help you while doing live demos.


You use it like this:

$object | Out-GridView 


I'll demonstrate with some built in commands:

CLI view:



GridView:



That's straightforward enough, and depending on your purpose and audience it may or may not be a small improvement.



Where Out-GridView really excels is its ability to automatically pivot from a list of properties to a set of columns:


Here's some PowerShell output that looks blindingly complex to a beginner:



Piped to Out-GridView it becomes more viewer friendly, and may eliminate extra scrolling:


For extra real-world value, you can copy and paste from the grid into excel to easily share and compare:



Something to notice:
For some objects you may need to Select the properties you want to see. 

From the example above you may have wanted some of the properties that were not selected automatically to pass down the pipeline.
So let's modify the command:
Get-NetIPAddress -InterfaceAlias loopback* | select IPAddress, InterfaceAlias, AddressFamily |  out-gridview






Out-GridView availability 

( A few versions of PowerShell Core didn't have Out-GridView because it wasn't compatible with Linux and Mac.)

On Windows: 

If you're running an old .NET Framework OR a reasonably new version of .NET… Out-GridView is just going to work for you.

For anyone interested in Cross-Platform usage: 

The thing you're probably looking for is: Install-Module Microsoft.PowerShell.GraphicalTools

See this for more info: https://devblogs.microsoft.com/powershell/out-gridview-returns/

Further Questions?:

As always discoverability is one of the core principles of PowerShell
get-help out-gridview -online





Comments

Popular posts from this blog

Default Browser - set url association with PowerShell

LINQ within a foreach()

Rules of Automation