Acerbity
Acerbity

Reputation: 527

Powershell interactive output

I have a question. I am looking to create a large script that queries multiple values on a large number of servers, and then gives you an output (Gridview or similar) so you can easily view all of the values. Gridview fits the bill, but I was wondering if it is possible to have an interactive output.

For instance, one of the servers has virus definitions that are out of date. I could right click on that row and run a script to update the AV definitions. Is something like that possible from Powershell, or should I be looking at something like C#?

Upvotes: 0

Views: 495

Answers (1)

mjolinor
mjolinor

Reputation: 68341

If you've got Powershell V3 or better, you can use the -OutputMode option of Out-Gridview to let the user select one or more rows from the gridview and send those objects on down the pipeline for further processing.

Depending on your application, you might need to save them to a variable, and then present another gridview of menu options to select what kind of maintenance they want to perform on them, but it's definitely do-able, and much easier than developing a UI.

FWIW, here's a link to a function I wrote that let's you display and select from a gridview of selected properties of an object collection, and then send the original objects down the pipeline.

http://gallery.technet.microsoft.com/scriptcenter/Select-FromGridView-521a56d8

Upvotes: 3

Related Questions