r/PowerShell • • Oct 15 '19

PSScriptMenuGui v0.2 now in PowerShell Gallery

202 Upvotes

25 comments sorted by

13

u/weebsnore Oct 15 '19 edited Oct 16 '19

Thanks to everyone who responded positively to my post a few days ago!

PSScriptMenuGui is a bit more mature and is now in the PSGallery.

The main new feature is an optional Arguments column that lets you pass (guess what) arguments to an external executable or to PowerShell (e.g. -NoExit).

I’ve also finished writing documentation and tidied up a bunch of the internal code.

Please try it out and let me know if it’s useful or if you find a problem.

GitHub link: https://github.com/weebsnore/PowerShell-Script-Menu-Gui

Cheers!

Edit: thanks for Gold!

6

u/ID10T-3RR0R Oct 15 '19

Love it, makes it super easy for my SD staff to run some of the tools I make. Any chance you could add the option to have dropdown bars per section if it has multiple scripts? Thanks!

2

u/weebsnore Oct 16 '19

Can you mock something up so I can see what you're thinking? MS Paint or whatever.

In general, I'm going to try and keep the module simple.

2

u/ID10T-3RR0R Oct 16 '19

So in each Section (ex: "Old School"), instead of each script having its own box you'd have a single drop down menu containing the scripts. Example picture : https://imgur.com/IoCsAQg

my awesome paint version before I realized the internet was thing... : https://imgur.com/huLL8r8

2

u/weebsnore Oct 16 '19

That's a cool idea!

Not a trivial amount of work, though, so not something I'll look at right now.

Happy to advise if you'd like to give it a shot yourself.

1

u/helixamir Oct 16 '19

I assume the idea is to have a drop down for your lists, and then depending on which list have buttons show for those scripts.

Might be worth having the form dynamically update in size depending on the number of buttons returned (would be a nice to have I guess).

Just ideas to add to the project without taking away too much of the simplicity of the operation.

1

u/JeremyLC Oct 16 '19

Do those comboboxes represent collections of scripts, or parameters for a single script?

2

u/froztymug Oct 16 '19

Love this. Think it'd be possible to have a button take you to a seperate gui menu?

3

u/weebsnore Oct 16 '19

You can associate any action with a button, so starting Show-ScriptMenuGui with a different CSV should work.

1

u/froztymug Oct 16 '19

Beautiful. Thanks again for sharing

1

u/weebsnore Oct 16 '19

No prob!

2

u/Syndrome1986 Oct 16 '19

Is there an easy way to add a text box that would launch scripts as a different user? Just enter the username you wish to run as and when you click a script it will ask you to auth.

2

u/weebsnore Oct 16 '19

You should be able to do something like this:

$credential = Get-Credential; Invoke-Command -Credential $credential -ScriptBlock {"do things"}

(some cmdlets also support -Credential directly)

...either as an inline script or in a .ps1 file.

Let me know how you get on.

2

u/Booo350 Oct 16 '19

Great work. It would be even greater if there was a way to provide preset arguments on the right side of the button instead of the text that is currently displayed. You know like listboxes, comboboxes or textfields.

That way you could use the same scripts for several different servers/users/environments.

Thanks for sharing

2

u/weebsnore Oct 17 '19

Sounds great!

I'll definitely bear it in mind for version 2.

A bunch of stuff would have to change. For example, I'm not sure it would make sense to select stuff on the right then click a button on the left.

4

u/__RocketMan__ Oct 16 '19

Just have to say, I really like this menu system. It's simple and straight to the point. Your documentation on Github is way better than most I find on there, and your module is so easy to use. Thanks very much for sharing this with the community!

1

u/GoneAPeSh1t Oct 16 '19

This looks interesting. What is it doing that requires version 5 ?

1

u/weebsnore Oct 16 '19

It may work on earlier versions, I haven't tested. Out of interest, what are you using that doesn't have PS5? Server 2012?

1

u/GoneAPeSh1t Oct 16 '19

2008 r2 for the next year

1

u/joho0 Oct 16 '19

Why are the buttons so HUGE?

1

u/weebsnore Oct 16 '19

What?! They're only 7500 pixels!

3

u/Cavm335i Oct 15 '19

Thanks! I was just looking for something like this to make my scripts more useable for younger admins

2

u/iam_papa Oct 16 '19

Looks nice , I will definitely try it out .. thanks for sharing

2

u/[deleted] Oct 16 '19

This is amazing! Thank you so much!!!

1

u/therealskoopy Oct 16 '19

Why not just use a configured MMC console and configure scripts as snap ins?

This is redundant