r/PowerShell • u/adbertram • Jul 20 '19
How to build a PowerShell menu
https://adamtheautomator.com/build-powershell-menu/7
u/JeremyLC Jul 21 '19
Your site layout is decidedly mobile hostile.
2
u/adbertram Jul 21 '19
I don't see this on iOS. Can you tell me what Android version you're using and browser?
1
1
u/adbertram Jul 21 '19
Hmm...that shouldn't be. Let me look into that.
1
2
u/SpacezCowboy Jul 20 '19 edited Jul 20 '19
If you use a do-until loop the menu can be returned after each option. Useful for a menu that can allow for running multiple switches in a serial order. Use case would be to execute a process of multiple steps where the next step can't be run until the previous steps have had time to complete. I've used this to make an easily selectable set of options, and walk the less skilled through handling the task themselves.
3
u/tkecherson Jul 20 '19
Mine uses the Do .. Until to force a user to choose one of the given options, if the returned value isn't a choice it loops back until the user does it right.
2
1
u/hngovr Jul 21 '19
How would i change the text color of the menu?
1
u/adbertram Jul 22 '19
You would need to use the $host variable. https://www.petri.com/change-powershell-console-font-and-background-colors
3
u/tkecherson Jul 20 '19
Interesting. I could have used this a week and a half ago when my boss told me to make my AD management module into a menu-based script, but I managed to get it working. I'll have to go through this on a PC later and see if I can improve what I have. Thanks!
8
u/Ghlave Jul 20 '19
Nice article but it is very difficult to read. The formatting you have in place makes the snippet below have a rather large horizontal scroll bar, even on a 1920x1080 maximized web browser.
}