PowerShell, Scripting, Surveys
comments 5

Graphical User Interface (GUI) for your PowerShell scripts: survey results

Last week, around the same time, I decided to a small survey on why scripters would choose to create UI for their PowerShell scripts and what do they use to create a UI. With that thought, I created a simple survey with just three questions and shared with you all twitter. This survey received 34 responses. I think this response is good enough to understand the major reasons for creating GUI for PowerShell scripts.
Note:
This survey was purely around what UI framework do people use to create UI for the PowerShell scripts and not about what tools they use. I included PrimalForms and Visual Studio only because they facilitate easier creation of UI. PowerGUI AdminConsole fits perfectly into the options if I were to do a survey on the tools you use to create GUI apps to wrap PowerShell scripts.
Thanks to all who answered this survey. So, with no further delay, here are the results:

Do you create GUI for any of your PowerShell Scripts?

Question 1

What are some of the reasons for creating UI for PowerShell scripts?

Question 2

#1 reason was expected. I have heard many administrators asking for this and doing it. “Other” reasons included:

  • Sometimes GUI is easier for picking up some values from a closed pool. I use it to define memberships for a new users in AD, or adding user to access groups there.
  • Sometimes faster to use GUI
  • Creating a Script with High End admin functions which can be passed to a SubOrdinate

In the above responses, option D and E take second place in overall votes. This shows that the UI still plays a role in automation. Especially, when the script requires complex input or when the overall automation flow requires executing several scripts based on a user input. GUI is the best option in such cases.

What do you use to create GUI?

#1 framework here seems to be WinForms. Although WinForms is an old fashioned approach to creating UI, it still rules because tools such as PrimalForms make it easy to create UI and export it to a PowerShell script very easily. I, personally, love WPF and do some scripting in that.

Another way to look (thanks to @Poshoholic) at the results is:

Ten respondents preferred using Visual Studio to create the UI (in either WPF or WinForms) and then exporting the C# code to PowerShell using Add-Type cmdlet. While nine people preferred to script the UI using one of the available modules (WPK or PowerBoots). This actually shows that the Visual Studio method is a bit popular than WPK & PowerBoots modules. Mostly because UI elements and design are taken care by Visual Studio. Of course, this method has pros and cons.

Both WPK and PowerBoots (currently Show-UI) are a bit complex and need more knowledge of using PowerShell. James Brundage and Joel Bennett did a great job at creating these modules for WPF. However, the community examples and help around using these modules is relatively less. I hope Show-UI (a merge of WPK and PowerBoots) fixes this.

Other votes went to options such as using Visual Studio for designing the UI and then exporting the C# code from there to a PowerShell script.

Filed under: PowerShell, Scripting, Surveys

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.