ConsoleGuiTools icon indicating copy to clipboard operation
ConsoleGuiTools copied to clipboard

Feature Request - Out-GridView, define/pass "default" filters through Parameters

Open PsychoData opened this issue 5 years ago • 0 comments
trafficstars

Migrated from https://github.com/PowerShell/PowerShell/issues/12228

Add parameters to enable you to pass default filters to Out-GridView windows for when they are first shown.

For example, if I was writing a process to look for processes of some sort, and I wanted to show a simple GUI to say which process to kill.

I could show them a list of all processes, but it would be a nice feature if I could show them just a list of processes under their username/login session, predefined as a Criteria Filter

Proposed technical implementation details (optional)

With the current/old way I could filter it before I push it to Out-GridView, but if they wanted to find a process from another user, it wouldn't work or would have to be handled more completely in code.

The result would let you filter further, but not go backwards. image

Where, if there was an option to pre-fill the form, we could show it to the user with Quick Search predefined like this image

or, even better, pre-define the Criteria directly so that they could still easily use the quick search image

If we could add a -DefaultFilter and/or -Criteria option, that might be sufficient. Perhaps it could even support the same FilterScript as Where-Object? If there was a way we could just pass Get-Process -IncludeUsername | Out-GridView -FilterScript {$_.Username -like "*Administrator"} and it predefined the Criteria from that, ending up looking like my final screenshot, I think that would be my Ideal implementation

PsychoData avatar Mar 31 '20 13:03 PsychoData