top of page
  • avicoren

System.Windows.Forms doesn't live here anymore

Updated: Dec 23, 2021


"The journey of a thousand miles begins with one step" Lao Tzu

So... I'm excited to post my first hands-on piece on a subject I am personally very passionate for - making modern UI apps using pure PowerShell code.


From spending a LOT of time around Sys Admins (I am a proudly one) I've noticed that the vast majority of them, are stuck with tools using the basic windows.form UI class which was nice a decade ago, but feels quite ridiculous these days.

Whenever you google "PowerShell GUI" you'll find those ready made windows.form scripts or step by step sites for building them. The easiest thing for a Sys Admin to do is downloading those ready made ones or build a new one with zero effort (and zero thoughtfulness for those who will use this script).


A GUI tool indeed. Hey, could you land me your Duran Duran Cassette tape?

Without an intension to offend anyone, I think that what those kind of scripts bring to mind is a sense of laziness of the author, a feeling of using an outdated tool (and as a result - a risky one to use). You got my point.

I really think those awful looking GUI tools (which looked very nice when Nik Kershaw was number 1 on Billboard's chart) are doing bad PR to PowerShell.

Other disadvantages of using an old technology are also obvious: new UI features and improvements that were developed over the last few years are not usable by those windows.form scripts, thus preventing the users from getting easier, friendlier, feature-rich tools.



A glimpse of Material Design look and feel on a PowerShell App




First things first.

What are the prerequisites for moving to a full-blown PowerShell script utilizing WPF with Material Design style? there are a few.

  1. A basic understanding of WPF concept. Just for the sake of knowing what it is and how different it is from windows.form

  2. Learning XAML. You don't have to be an expert on that. A basic knowledge will let you start developing in no-time and the more you know the more sophisticated things you will be able to do.

  3. Knowledge of PowerShell scripting language (Duh?!)

  4. .NET framework version 4.5.2+ installed on any Windows machine running those scripts.

  5. Windows PowerShell version 5+ or any PowerShell 6/7 installed

  6. Two MaterialDesignInXaml libraries called MaterialDesignColors.dll and MaterialDesignThemes.Wpf.dll Just download them from my GitHub (They're at the Assembly folder). It's all covered in this post.

  7. We will also need MDIX's Demo app as it shows you all of the UI elements and the Xaml code. It can be downloaded here.

What else will you need?

A text editor. Any editor will do, but using Visual Studio Code is very much recommended especially with some popular PowerShell extensions installed. You can also code with the built-in PowerShell ISE. No problem with that.



Be sure to check out my next posts once you have all what's needed for you to start working on your new and awesome script.


779 views0 comments

Recent Posts

See All
bottom of page