Creating a Simplistic GUI Interface with Out-GridView

A couple of weeks ago I noticed a post in the forums at where a question was asked about selecting a group of servers in Server Manager and running a PowerShell script against that selection of machines. While my solution doesn’t accomplish exactly what I think they were looking for, it does the next best thing.

First, I added a menu item to Server Manager called MrToolkit (short for Mike Robbins Toolkit) based on a “Customize Tools menu in Server Manager” blog article on the TechNet Server Manager Blog:


The item I added is a .bat file that contains the following code:

Notice the tweaks in the previous code for bypassing the execution policy and running it with no profile. I also had to add the PassThru parameter to the last Out-GridView otherwise the command finished and exited without the user being able to see the results.

Those tweaks aren’t necessary if you just want to run the actual PowerShell code:

One thing to note is using the Out-GridView cmdlet requires the PowerShell ISE to be installed and Out-GridView being able to send its results to the pipeline was a feature introduced in PowerShell version 3 so those are the minimum requirements.

This command first returns a list of all the servers in the domain that are enabled:


After selecting the Servers you want to run a script against and clicking <OK> as shown in the previous example, the user is prompted to select one of the scripts that exists in the specified directory:


The user is limited to selecting one script, after selecting it and clicking <OK>, the selected script is run on the remote machines and the results are displayed:


When the user clicks <OK>, the Out-GridView window and all traces of the command disappear. How’s that for a simplistic GUI interface for your PowerShell scripts?



  1. Thomas Kreis

    powershell code either from BIOSInfo.ps1 or Get-DiskInventory.ps1 as example would be nice to get from here


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: