r/PowerShell • • Jul 07 '19

Tutorial on creating Powershell applications using Visual Studio

https://domruggeri.com/2019/07/06/creating-extensive-powershell-gui-applications-part-1/
197 Upvotes

29 comments sorted by

View all comments

19

u/StartingOverAccount Jul 07 '19 edited Jul 07 '19

OK so this is one those thing I've wondered about a few times. Why would anyone create a GUI using Powershell (for a production task)? I see these posts every once in a while in forums and it just doesn't make sense. This tutorial is with Visual Studio. If you have VS why not just use C# or (shudder) VB? You'll get a much nicer UI, built in error handling, mult-threading (if needed).

This is one of those things just because you can, should you.

(yeah I've setup a couple forms on PS just for the fun factor)

Edit: The wondering is more out of curiosity. I don't have strong opinions for or against it just there are better ways to create a UI

15

u/thankski-budski Jul 07 '19

Speaking for myself, the domain I work in has PowerShell readily available and it is trivial to leverage Windows Forms or XAML GUI's, combined with the simplicity of PSRemoting and CIMSessions makes it an attractive approach, albeit with a 'quick and dirty' feel.

The sheer amount of bureaucracy I would have to wade through to even begin to develop and deploy an executable means for most use cases, it just would not be worth it. It would take several months and a strong business case, whereas with a PowerShell GUI, I can just plonk it into a shared area and give people a shortcut.

I do agree that it might not always be the best tool for the job, alas I seem to spend my life doing things using obscure methods because for one reason or another I just can't do them the proper way.

Although, I would imagine that most enterprise domains are not this restrictive, so I'm probably an edge case.

4

u/dextersgenius Jul 07 '19

The sheer amount of bureaucracy I would have to wade through to even begin to develop and deploy an executable means for most use cases, it just would not be worth it. It would take several months and a strong business case, whereas with a PowerShell GUI, I can just plonk it into a shared area and give people a shortcut.

This is exactly my situation. We also have Applocker enabled across all environments that we manage (including our own devices where we don't have admin access), so we can't just plonk an exe somewhere and expect it to work.

1

u/pertymoose Jul 08 '19

So get a developer certificate and sign your own applications.