Interactive Select from List in Powershell

advertisements

Is there a plugin or tool that will let me display a list of objects to a user (Format-Table style) and allow them to use the cursor to select a choice from the list, including potentially scrolling a long list? I would like to be able to do something like this:

Get-User -anr $search |Get-Choice| Set-User -EnableAccount true

This script should display a list of matching accounts at a console prompt, allow the user to scroll up and down the list interactively, and select a choice by pressing Enter (or pass null if the user hits escape). Only one account would be passed to Set-User, rather than a list of all matching choices.

Obviously details could differ. While I would prefer a console version, a graphical one would be acceptable (that popped up a Windows dialog). The exact keystrokes could be different. But the core goal (accepting a list, getting user input, piping out the result) should be met.


in v3:

Get-User -anr $search | Out-GridView -PassThru | Set-User -EnableAccount true