Use PowerShell to View and Filter Information

Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to view and filter information.

Hey, Scripting Guy! Question Hey, Scripting Guy! I am not a scripter—never have been, never will be. But over the years I have used lots of people's scripts to do different things. I actually got some of my favorite scripts from the Scripting Guys—scripts that create an HTA that allows me to filter and manipulate data.

The cool thing about this is that all I need to do is to double-click, and boom! It pops up and does what it needs to do. I would love to be able to use Windows PowerShell to do something like that, but I really don’t want to have to go to all the trouble of finding new scripts and all that. Besides, as I understand it, Windows PowerShell scripts are not double-clickable. Can you help?


Hey, Scripting Guy! Answer Hello LT,

Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about Windows PowerShell is that it has a number of mechanisms for handling output. One can output a CSV file and open the file in Microsoft Excel. One can output XML and open the file in a browser. Or one can output text and view it in Notepad. There are even cmdlets that create HTML or send emails. One can also write scripts and present information in Windows Forms, WPF, or some other mechanism if one desires to do so.

As for clickability…

I wrote a script that creates a shortcut to a Windows PowerShell script and calls Windows PowerShell to launch the script, so it is possible to have clickability if one wants it. In fact, I created a Start tile on my Surface that launches a Windows PowerShell script to display remaining battery life. So yeah, it is doable.

This requires a bit of work

By far, the easiest way to interact with and look at output is to use the Out-GridView cmdlet. What is so cool about this is that it permits me to filter my output, sort my output, and to view my output. So rather than having to use Windows PowerShell to filter the output that displays to the Windows PowerShell console, I can use a graphical tool to do this instead. It is great for administrators who don’t want to learn Windows PowerShell, but would still like to use Windows PowerShell to gather data.

In the example that follows, I pipe the output from Get-Process to the Out-GridView cmdlet:

get-process | Out-GridView

The grid control created by the command is shown here:

Image of grid

Now, I click Add criteria, and select the column I want to work with from the following drop-down list:

Image of menu

After I select ProcessName, I am provided with appropriate operators. I click the highlighted operator contains and change it to equals. This is shown in the following image:

Image of menu

I am interested in the instances of the iexplore process, so I type that into the text box to the right of the operator. As shown here, my output changes, and I am only looking at the instances of iexplore:

Image of output

If I want to sort by which process ID is using the largest working set of memory, I can click the button labeled WS(K). The output changes and will be sorted based on largest to least—or if I click again, it will sort from least to largest. This is shown here:

Image of output

There is a lot that we can do with the Out-GridView cmdlet, and this will get you started working with it. For more information, see this series of Hey, Scripting Guy! Blog posts.

LT, that is all there is to get you started using Windows PowerShell with the Out-GridView cmdlet. Don’t Learn Windows PowerShell Week will continue tomorrow when I will talk about more way cool stuff.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 


Discussion is closed.

Feedback usabilla icon