Saw this on the VI PowerShell blog today. Antonio at Vmware wrote a cool script that takes an object as input, and will automatically create a simple graphical table using the fields (properties) you specify from the object. You can also have it create buttons on the form which will perform an action on the highlighted item. As he notes, this will allow you to create a simple application you can give to another person (say, a junior sysadmin type).
Now all it needs is a way to refresh the original object. Maybe the -data parameter could accept a scriptblock object, and a “-refresh” switch parameter would cause a Refresh button to appear on the form. Clicking that button would of course re-invoke the scriptblock and update the form’s contents.
So check out the article, it’s called PowerShell GUIs, and the out-form.ps1 script is here.
Here’s what it looks like! I used my Get-hVm script to create the input object.

No comments yet.