Mr. Roboto

PowerShell Pro Forma

Microsoft doesn't offer any sort of PowerShell forms editor -- but Sapien Technologies does.

You're probably familiar with Windows PowerShell as a console-based management tool. By default and design, PowerShell version 1.0 doesn't have any graphical interface elements. However, because PowerShell is built on .NET Framework, it can access the framework's Windows Form classes.

With these classes, you can build a graphical interface to your script. The downside is that you manually have to define every button, drop-down and text box. This can be a very tedious process. Microsoft doesn't offer any sort of PowerShell forms editor, but I know someone who does -- and it won't cost you a thing.

Sapien Technologies has released PrimalForms, a free Windows forms editor designed for PowerShell scripts. Get the tool at, install it on your Windows XP or Windows Vista desktop, and you can begin creating new forms.

If you've ever used a Visual Studio-type application, the interface will be familiar. PrimalForms will create an empty form container. You can drag and drop form elements, commonly referred to as controls, from the left-hand panel, and edit selected object properties in the right-hand panel. You should be able to accept most of the default properties, although you'll probably want to change the control's name to something meaningful as well as change the default's text value. Some controls, like FontDialog, aren't likely to be used in PowerShell scripts, so you can safely disregard them.

Of course, the control properties are only part of the story. What happens when a user clicks a button or selects an item from a drop-down menu? Those are events you've defined using PowerShell. Select a control and then click the Event icon above the property panel. In any of the event property fields, enter the name that will be used for the corresponding PowerShell script block. When you start developing your script, you'll need to add PowerShell commands to make your form and script do something.

Once you've finished your form, you can save it for future use or revision. To get your form into a script, you can export it to a PowerShell script or copy the form's code to the clipboard and paste it into a PowerShell script. When you examine the script, you'll see how much time PrimalForms has saved you. Now, just add your PowerShell code to the script blocks, test and deploy. You'll find this much easier with a scripting editor such as PrimalScript.

Practical Applications
What kind of PowerShell scripts might you want to create? How about a simplified user account tool for resetting passwords? Maybe you need a

PowerShell script and form to display system information from Windows Management Instrumentation and the registry for the help desk. Or perhaps you need a script to get and set service account information.

PrimalForms ships with a Getting Started Guide that I encourage you to read. It will walk you through the details of creating a form and PowerShell script. PrimalForms also ships with several sample forms and scripts that you can use as templates or tutorials. I've also posted a demonstration form and script at, which I encourage you to download.

You may need to refer to the MSDN documentation for a few of the form controls that you might not be familiar with. However, once you understand the basics, you'll be creating PowerShell forms and scripts in no time that will make Windows administration even easier -- and maybe even a little fun.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at, and a frequent speaker at technology conferences and user groups.


  • Why You Might Not Be Getting the Latest Office 365 Updates

  • Microsoft Fixes OneDrive for Business Linux Problem

comments powered by Disqus

Office 365 Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.