Better Know a PowerShell UI: WPF or WinForms?

2 minute read

Welcome to the first installment of my long running series on PowerShell UI development! Today I’m going to talk about why I choose to write UIs in WPF over Windows Forms.

When I originally started writing PowerShell UIs, I started writing them with Windows Forms. I chose Windows Forms over WPF because I was told it is easier and quicker. The reality is, this is only true for novices. Generally when people first start learning a new technology, they write simple things to get their feet wet. If you buy the right tools, simple Windows Forms UIs are easier to write than simple WPF UIs. This is why most people recommend Windows Forms over WPF. If you don’t want to spend money, or want to do something more advanced with your UI, Windows Forms is not the right technology for you. Here are the reasons why I decided to switch to WPF and continue writing my UIs in WPF:

Visual Studio

One downside of Windows Forms is the only designer out there for PowerShell UIs is not free. There was once a free editor out there, but that was taken down by the company that makes it. For WPF, the free version of Visaul Studio gives you a professional level UI editor and the code it generates can be copy and pasted right into a PowerShell script and ran with very few modifications.


The UIs you design in Visual Studio will not be in PowerShell, which has a hidden benefit. The UI you design will be in a language called XAML, which is basically XML. Becasue of this, you can find resources to help you with WPF from people outside the PowerShell community. The code for the UI you create can be used in any .Net language with almost no changes, so you can find resources from any .Net community to help in your WPF UI.

Gateway Drug

As you create your PowerShell UIs, you’ll start seeing code in other languages and become familar with the tools (Visual Studio) to code in those langauges. Because of this, it will be easier and easier to start programming in other languages (mostly C#) without you even realizing it!


A WPF UI will automatically take on the theme of the computer it is run on, so it will look like a modern program as opposed to something written for Windows XP. On top of that, WPF is DPI aware so the UI will look better on computers with strange DPIs, which we are seeing more and more of as 4k monitors get smaller and smaller.

Easier to Learn

Writing Windows Forms in PowerShell is just not very user friendly. There are editors out there which makes it so you don’t have to learn any of the Windows Forms code, but what happens when there is an error? You’ll have to troubleshoot a script that you didn’t even set up yourself! In XAML, all the UI elements are in the XML code and then the rest you design. To me, this makes the code easier to look at, easier to troubleshoot, and easier to code in.

That’s it for now! If I missed anything or you want to start a discussion, I hear comments on blog posts are always the best place to do that!

Leave a Comment