3 scenarios when you should add GUI to Powershell script
If you’re advanced Powershell user, probably you know that Windows Powershell allows you not only to prepare scripts but also the graphical user interface. One main question is when you should prepare a GUI and when it’s not a good idea. Also, In my mind is one more question, what with Powershell Core. In this version of the blue console, you can’t add a GUI to Powershell. I asked the blog readers about their user experience in creating a GUI and add it to the Powershell script. Now I want to list a few scenarios when it’s a good idea to create a user interface and when it’s not.
You can prepare GUI in Windows Powershell
Before I list the scenarios, I would like to explain to you why Windows Powershell allows creating GUI for Powershell scripts. Now Microsoft shares two different versions of Powershell: Windows Powershell and Powershell Core. In the post, Poshland Blog is not only for Windows Users? Powershell Core, you can read more about the differences between Windows Powershell and Powershell Core. If you are using the Microsoft Windows operating system on your workstation, you can use Windows Powershell which is available by default. In this version, you can create GUI for your scripts because it based on the full version of .NET Framework, which allows to do this.
Powershell Core and GUI? I don’t think so!
If you want to create a GUI in Powershell Core, this option is not available now. Powershell Core is a multi-platform version based on .NET Core. This version does not contain the required libraries to create a GUI. Maybe it will change in the future because .NET Core 3 contains the required library for creating the user interface on the Windows operating system.
Powershell Core is a multi-platform version based on .NET Core.
3 scenarios when Powershell script should contain GUI Front-end
Delegate tasks for other people
The first and basic scenario when you should prepare user interface for Powershell script is delegating tasks for another person. If you wrote really functional Powershell script, but nobody knows how to use it from the command line, don’t waste time and try to create GUI for these people.
Run many Powershell scripts from one place
Next situation from my experience is running many scripts from one interface for easier use. Sometimes Powershell users run many Powershell scripts a lot of times per day. Sometimes, it will be more productive to run these tasks from GUI than a running script from Powershell console.
Load data and choose which you want to modify
The last example is a more advanced script to load data from application or system and choose one option to run specific modification. Let’s explain by example. If you want to modify issue in Jira but you don’t know id number. Your Powershell script loads a list of issues and you can choose one of them and run another script to modify this issue. It’s easier to do from GUI than Powershell console.
Powershell script with GUI can be full functional application?
This is paragraph inspired by one of the readers. In my honest opinion answer on the above question is – No! The Powershell is very popular for automating IT infrastructure management. Also, I promote it for using to automate our office work if it’s not required to developing a fully functional application. Sometimes it’s enough to write Powershell script and GUI to automate our jobs and save time. Especially small business requires creating automation when it’s unprofitable to develop a dedicated application. In my opinion, it’s a good way. However, if you need more than work automation, I recommend you develop a dedicated application.
Let’s summarize. The Powershell allows you to create GUI. You can use Powershell GUI in any scenario. However, Powershell wasn’t designed to develop the applications. Please remember about it.
What is your opinion about GUI for Powershell scripts?