Windows Presentation Foundation via PowerShell – Introduction

I did a survey (on GUI for PowerShell Scripts) a while ago to understand what frameworks do people use when they need to create a user interface (UI) for their PowerShell scripts. The responses clearly showed WinForms was one of the favorite choices for several reasons I mentioned in that post.

Most used UI frameworks
Most used UI frameworks

Both WPK and PowerBoots were powerful frameworks which enabled creation of Windows Presentation Framework (WPF) based user interfaces in PowerShell. But, in my opinion, lack of community examples and WPF awareness made people to stay away from these frameworks. However, this perception may slowly change. The brains behind WPK and PowerBoots, came together to create what is known as ShowUI. This new framework promises to make the complicated world of WPF easy to use in PowerShell. ShowUI is currently in version 1.0 and can be downloaded from http://showui.codeplex.com/.  James, Joel, and Doug have been doing several blog posts and videos to show the power of ShowUI. So, this is the right time to start exploring ShowUI, ask questions, or provide feedback.

Coming to the subject of this post, when I wanted to learn WPF and start using that knowledge in PowerShell, I had to go through a painful process of reading a developer oriented book on Windows Presentation Foundation. I am not a developer; I am just an IT Professional with keen interest in PowerShell and automation. So, naturally, it was tough for me understand every aspect of WPF as all examples were in C#. In my opinion, understanding the concepts of WPF is very important to be able to appreciate the power and usefulness. Also, this knowledge makes it easy when you start writing user interfaces in PowerShell using modules such as ShowUI.

So, I am starting this series of blog posts to explain the concepts of WPF and show how to use WPF in PowerShell. I intend to start from the very basics of WPF and explain the concepts such as

  • XAML
  • Element hierarchy in WPF
  • Layouts
  • Controls
  • Templates
  • Styles
  • Data binding
  • Etc

All that I just mentioned will use PowerShell only for all the examples and of course, will be using ShowUI module. Also, all these posts will be written with an IT Pro in mind. So, I will try and explain the concepts in an easy to understand manner and with as many real-world examples as possible.

What do you need to get started?

  • You need to have some basic knowledge of PowerShell.
  • You need a system with Windows OS and PowerShell v2.0
  • You need to have at least .Net framework 3.0 installed or Net 4.0 for more WPF goodness
  • Latest version of ShowUI

If you need a quick overview of what is ShowUI and what it can do for you, visit http://showui.codeplex.comhttp://www.dougfinke.com/blog/index.php/category/showui/, and the blogs of James and Joel.

This is it for now. This post is just an introductory one and shows what I intend to write in the coming weeks. We will see a quick overview of WPF in the upcoming post and slowly build upon that foundation to understand how to use WPF in PowerShell. Also, at the end, I plan to make this entire series an eGuide and make it freely available for download.

Stay tuned!

  • Sap_dreams12

    HI Ravi,

    Can you please help me with your suggestion how to create virtual machines by taking a location i.e system name from a textbox text in webform once a button is clicked it has to create a virtual machine on that particular location

    just need step by step instructions – right from complete requirements

  • Sap_dreams12

    HI Ravi,

    Can you please help me with your suggestion how to create virtual machines by taking a location i.e system name from a textbox text in webform once a button is clicked it has to create a virtual machine on that particular location

    just need step by step instructions – right from complete requirements

  • http://www.ravichaganti.com/blog Ravikanth

    I have no experience with WebForms. See if this link helps: http://devinfra-us.blogspot.com/2011/02/using-powershell-20-from-aspnet-part-1.html