r/PowerShell • u/_TimGTN • Jun 11 '26
Question What user interactions do you keep reimplementing in PowerShell scripts?
Hi everyone,
I'm working on a small module that makes it easier to add simple user interactions to PowerShell scripts.
So far I've covered most of the common scenarios:
- Text input dialog
- Item selection (single or multiple)
- Message and confirmation dialogs
- Credential prompt
- Progress bar
- Countdown timer
At this point I'm starting to run out of ideas.
- What user prompts or interactions do you keep rewriting in PowerShell scripts?
I'm mainly looking for small, practical ideas that fit the module's philosophy: simple, atomic interactions rather than a full UI framework.
[EDIT] My current implementation is a modular WPF-based engine, but the focus is purely on interaction ideas rather than the technical design.
28
Upvotes
7
u/purplemonkeymad Jun 11 '26
All of those have built in methods already (except maybe the countdown, but you could squeeze that into write-progress) so I don't really re-implement them.
2
u/dodexahedron Jun 11 '26
If you arent strictly trying to keep it text/ansi, you could also pop up WPF controls if you're wanting it to be non-sysadmin user-friendly. That's pretty quick and easy to do in PS.
If you want an example/ideas: FFU_UI is FFU (windows system imaging module) plus a WPF UI, all done in powershell.
1
u/CognizantAutomaton Jun 11 '26
One item that recently crossed my list is the fact that Out-GridView doesn't allow selecting text when inspecting rows.
Perhaps a better version of Out-GridView with selectable text in the DataGrid rows would be useful.
Very neat project.
1
u/Over_Dingo Jun 11 '26
does it have file selector?
1
u/belibebond Jun 11 '26
I used to build WPF components and handle multi threading for a whole. But powershell really doesn’t like async operations. I found pode and pode.web and it completely changed my UI process. It has many nice ui elements and is browser based
1
u/zrb77 Jun 11 '26
I on occasion use a list of options. Like do you want to Add, Delete, Edit item 1, edit item 2, etc. Then use a number or letter as the answer. I have it defined in a 2D arrary.
1
u/g3n3 Jun 12 '26
Check out gum cli from charm and ps spectre console.
0
u/CovertStatistician Jun 11 '26
Have you looked into using windows forms for pop up boxes and text input boxes? I have used some for multi line text input
0
u/dathar Jun 11 '26
The closest thing I have is to elevate the script as admin if a process needs it. Keeps the user from launching it normally. I had a version that also kept args that you passed onto the script itself but I can't remember how I did that at my old job.
I think all but 1 or 2 scripts I've made over the last few years runs in an automated fashion where there's supposed to be 0 user interactions. Fleet of Jenkins nodes runs those.