Description
Course info
Rating
(32)
Level
Intermediate
Updated
Sep 23, 2016
Duration
2h 21m
Description

At the core of creating PowerShell UIs is a thorough knowledge of Windows Presentation Framework. In this course, Building PowerShell GUIs in WPF for Free, you will learn how to create UIs for your PowerShell scripts. You will first learn how to create WPF XAML and import that into PowerShell. Then, you'll learn about the controls and spending some time working with them. Finally, you'll learn how to create executable PowerShell scripts with UIs for redistribution. When you're finished with this course, you will have a foundational knowledge of creating UIs in WPF for PowerShell that will help you as you move forward to creating your own UIs for your PowerShell scripts.

About the author
About the author

Jeff previously worked at Microsoft for over 8 years in MSIT going through multiple release cycles of SharePoint, Exchange, Groove, Office and Lync.

More from the author
Provisioning Office 365
Beginner
1h 36m
9 Mar 2018
Getting Started: Microsoft Identity Server
Intermediate
2h 16m
17 Mar 2017
More courses by Jeff Adkin
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Jeff Adkin, and welcome to my course, building PowerShell GUIs in WPF for free. I'm a practice lead at Online Business Systems. One thing I want to mention is that PowerShell is the most used IT automation tool out of the entire Microsoft stack. Now because of that, in this course what we're going to be doing is we're going to take all of our PowerShell scripts, and we're going to create GUIs for them in WPF. Now some of the major topics that we will cover include using the Windows Presentation Framework XAML in PowerShell, having PowerShell work with the GUI controls, we're also going to be using Visual Studio designer to create our GUIs, and we're going to turn our scripts and UIs into executable programs. By the end of this course, you'll know how to create GUIs for PowerShell in WPF for free. Before beginning the course, you should be familiar with the basic PowerShell syntax. From here, you should feel comfortable diving into PowerShell and WPF with courses on building advanced functions in PowerShell, WMI and CIM in PowerShell, and of course WPF productivity. I hope you'll join my on this journey to learn building PowerShell GUIs in WPF for free at Pluralsight.

Understanding Basic WPF UI
Hi and thank you for joining me for building PowerShell GUIs in WPF for free. In this module, we're going to go over understanding basic WPF UI. My name is Jeff Adkin. I'm a Pluralsight author, feel free to follow me on Twitter @JeffAdkin, or check out my website at JAdkin. com. All right, what we're going to do now is we're going to jump straight into an introduction and we're going to talk about what we're going to talk about. I know, semi-redundant but bear with me here. So, we're going to go over the following components, we're going to go over a WPF overview. Get an understanding of what is WPF. And then, we're going to talk about WPF versus Windows Forms. Why are we using WPF but majorly, what is the difference between the two of them? They're both good in different scenarios and PowerShell can use both of them. From there, we're going to talk about XAML, and understanding XAML, which is the basis of all WPF and how we're going to be setting up all of our windows and forms, et cetera. So, speaking about our windows, the next thing we're going to do, is we're actually going to go in and we're going to create a XAML window. We're going to take what we've learned and we're just going to start building. From there, we're going to add a control to our WPF window last but not least, we're going to talk about WPF layouts and why they're so important. Okay, I guess that means we should go start on WPF overview.

Working with WPF Controls
Welcome back. What we're going to do now, is we're actually going to sit down. We're going to talk about working with WPF controls. Now, like I've said before, my name's Jeff Adkin. Feel free to follow me on Twitter @JeffAdkin or check out my website at JAdkin. com. Okay, let's go talk about what we're actually going to be going over. Just like every other time, we're going to do an introduction. So, we're going to look over some of the main controls only. There's a ton of different controls that are available to us, but these are the six that I actually want to focus on. So, right off the bat, I want to focus on button. I know we've already done button, already, but what we're going to do now, is we're just going to add a little bit of flavor to it. From there, we're going to head off and we're going to talk about labels. And of course, TextBoxes. Then we're going to talk about ListBoxes, image, and last but not least, a TextBlock. The reason why I picked these six things, is with these six, we can basically turn around and create a decent, beginning program. Now remember, we're looking at taking PowerShell, which is great for a quick automation and scripting and basically creating a UI overtop of it. And in most of the UIs that I've ever created, these are the six ones that I've always needed to use. All right, that being said, let's put these back and we're going to go after buttons. See you there in a moment.

Creating an Event Viewer
Hi, and welcome back. What we're going to do now is we're going to spend a couple, and spend some time creating our own Event Viewer. So let's go take a look at an introduction on what we're actually going to be doing. So, first things first, we're going to have to create the UI. We're going to have to this in WPF, that's what we're learning right now, and what we're going to do is, we're going to make sure that we set it all up in XAML first, that way, we have our UI completely built. Now, from there, we're going to go create On_Click functions. Now, that automatically means we are going to be using a button for this. Now that we have that actual On_Click function, we're going to have to create our own PowerShell functions as well. Last but not least, we're then going to have to run the code, and we're going to have to make sure it actually works. So, these are the four basic things we're going to be doing. Before we jump into that, let's take a moment and just look over a quick flow quick flow of what we're actually building here. So, for the Event Log GUI, what it's basically going to be is, the program's going to start, we've got our inputs, we're going to have an Event ID textbox, where we put in the Event ID, we're going to have a DatePicker where we actually get to pick the date we want it searched for, and of course, we're going to have a computer name so we can search multiple systems out there, and then we'll have a Start Button that when we click, it will automatically go and check all the event logs based on the information we gave it. Now that's going to, of course, mean that we're running it in a PowerShell function. The PowerShell function, when it gets all that information back as output, it's going to have to put that into a Results Textbox, something we can actually see and read. And that's it, then it's done. Now of course, we can always go back, put new information in, go back and click the Start Button and go through it all again. But this is the basic flow of what we're going to be building. So first things first, let's take off, and let's go create that UI.

Creating a Full Executable Program
Hi, and thank you for joining me for the last module. What we're going to do right now is go over creating a full executable program. So let's go over what we're going to be doing exactly. So right off that bat, we're actually going to spend a moment, we're going to talk about using tabs. And the reason why we're talking about tabs, is because we only have so much real estate, and tabs allow us to basically double or triple up on that real estate and in our case, we're going to quadruple up on that real estate. From there, we're going to go in and we're actually going to layout our main UI and then we're going to layout all of our secondary UI's, which basically means all of our extra tabs that we're going to be using. From there, we're going to setup our controls, and then we're going to create the functions, the PowerShell functions and then we'll create the actual executable program. So we can create an EXE out of this PowerShell code that we're doing, and last but not least, we're then going to turn around and we're going to run all of it. So let's take a moment and actually go over a nice high level flow chart. Now I know these are very simplistic, but it gives us a good idea of what we're going to be doing. So in our program, what we're going to do is we're going to start. We're going to have some input and the input we're going to have is Computer Name and we're going to have a start button with it and what's going to happen there is when we click the start button, we're going to start getting information about that computer. We're going to get CIM information, we're going to get event information, and process information, and then we're going to add all of that information to our fields in our different tabs. And that'll allow us to basically create a quick program that'll reach out to any computer system that we have access to of course and be able to grab all of this information back to us. Okay, so let's stop here and let's move forward with actually talking about using tabs.