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
1
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
2
1
u/therealskoopy Oct 16 '19
Why not just use a configured MMC console and configure scripts as snap ins?
This is redundant
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!