I recently released the first version of PowerShell Pro Tools for Visual Studio 2017. The first version provides only one feature; Windows Forms designer support. In this post we will go over how to create a Windows Form using PowerShell.

Installing the necessary tools

You will need the following:

Creating a Project

You can create a module or script project.

Click File->New->Project

Select the Module or Script project type, name it and then click Ok.

Create the Form

After installing the Pro tools, you should now have a Form item template available. Right click on your project and select Add->New Item.

Once the New Item dialog pops up, select the PowerShell Form template, name it and click Ok.

Working with the Form Designer

Adding Controls

The form designer works the same way with any language. You can select items from the Toolbox window and drag them onto your form. Properties of the controls can be set using the Properties window.

Adding controls automatically updates the Form.Designer.ps1 file. Do not edit this file by hand as the editor will simply recreate it after changes are made to the form.

Adding Event Handlers

To do anything interesting, you’ll need to add event handles. You can access a control’s events by selecting it in the designer and clicking the Event button in the Properties window.

Enter the name of your event handler function and click enter.

After you press enter, you will be moved into the code-behind view where you can wire up your event handler.

The event handler will automatically be wired up to your control.

Debugging A Form

Once you are ready to test out your form, you can click Start or press F5 from either the designer window or the code-behind window. PoshTools will fire off the script and you can set breakpoints and debug like any other PowerShell script.

And just like that you have a working Windows Form.


The PowerShell scripts generated by PoshProTools can be used in any PowerShell host. The designer and code-behind files can be joined into a single script. This is a manual process at the moment but I’m thinking about creating a “build” step that does this automatically.

Feel free to try PowerShell Pro Tools for free for a couple weeks. I would love to hear your feedback.

Stay tuned for new features in PowerShell Pro Tools. Next up: WPF.