Start with 7 free days of training.

Gain instant access to our entire IT training library, free for your first week.
Train anytime on your desktop, tablet, or mobile devices.

This PowerShell 4 training course from trainer Garth Schulte covers Microsoft's automation and management framework. PowerShell provides efficient and scalable management of Windows environments. This is the perfect time for you to become a PowerShell expert! This course will take you from zero to scripting hero, even if you have no prior PowerShell experience....
This PowerShell 4 training course from trainer Garth Schulte covers Microsoft's automation and management framework. PowerShell provides efficient and scalable management of Windows environments. This is the perfect time for you to become a PowerShell expert! This course will take you from zero to scripting hero, even if you have no prior PowerShell experience.

Join Garth on a journey through the foundations of PowerShell 4 and beyond, where we learn by doing against a client/server network spanning many versions of Windows with live demonstrations and lab challenges. We start small with a single machine to cover the basics and work our way up to real-world scripting against a full network of Windows machines. Even though there is no formal PowerShell certification, scripting and automation skills are a must-have for any IT pro.

Recommended Experience
  • Familiarity with Windows client/server environments
Recommended Equipment
  • Windows operating system
  • PowerShell 4
Related Certifications
  • Not applicable
Related Job Functions
  • IT professionals
  • Automation specialist
  • Scripting wizardry
Garth Schulte has been a CBT Nuggets trainer since 2002 and holds a variety of Microsoft certifications, including MCSD, MCSD.NET, MCDBA, and MCSA. His areas of expertise extend to Visual Studio 6, Visual Studio .NET Windows/Web Programming, and SQL Server 6.5-2012.
 show less
1. Welcome to PowerShell 4 Foundations! (21 min)
2. Installing PowerShell 4.0 (15 min)
3. Getting Started (23 min)
4. Getting Help (25 min)
5. Commands (17 min)
6. The Pipeline (15 min)
7. Objects (26 min)
8. Extending the Shell (18 min)
9. Extending Objects (19 min)
10. Formatting Output (18 min)
11. The Pipeline Returns (21 min)
12. Providers (14 min)
13. WMI & CIM (27 min)
14. Remoting (20 min)
15. Jobs (17 min)
16. Workflows (20 min)
17. Scripting - Getting Started (17 min)
18. Scripting - Essentials (32 min)
19. Scripting - The Real World (26 min)
20. Desired State Configuration - Getting Started (21 min)
21. Desired State Configuration - Making it So! (18 min)
22. Tips, Tools, and Resources (7 min)

Welcome to PowerShell 4 Foundations!


Hello, my friends, and welcome to PowerShell 4 Foundations. My name's Garth Schulte. I'll be your host throughout this course where we're going to learn all about the future of administration configuration and automation here in Microsoft environments.


Now is as good a time as any to get some PowerShell skills in your toolbox. Maybe you've been avoiding PowerShell. Maybe you just haven't gotten to yet. Or maybe you clicked on that little blue button in the taskbar out of curiosity and said, you know what, this is just a glorified command dot exe with a blue background.


No, thanks and you go back to your GUI ways. Well, I'm here to tell you and show you that PowerShell is a big deal. Microsoft is serious about it, an employers are starting to get serious about it. And once employers really understand what PowerShell is and what it can do, they see two things, right, they see time and they see money.


In these are two areas that PowerShell can give back immensely. In fact, if I'm an employer right now looking to fill administrative position, and I've got some candidates, you know what I'm going to do? In fact, let's do this. Let's say we've got Bob over here, and we've got Joe over here.


So Bob and Joe are vying for the same job. What I'm going to do is I'm going to give them a common everyday task. Maybe I've got 50 users in a department that all need their password reset or some attribute changed in Active Directory. Well, I'm going to give Bob and Joe that task and say, go do that.


Come back when you're done. And let's say that Joe, Joe's like Bradley Cooper from Limitless. Anybody see Limitless where he takes the smart pill and he's like a ridiculous genius? Well, let's say Joe took the PowerShell pill. Joe writes a couple commands or turns it into a script, and does it, comes back in maybe a minute, and says, oh, by the way, it's done.


And I made it repeatable. Here you go. Here's the script if you ever need to do that again, Boss. Where Bob is still over there waiting for Active Directory to launch. He's farting around in the GUIs. Come on, Bob, get with the show. PowerShell's the future.


And you know, obviously, who'd get hired there is Mr. Joe. So together, you and I are going to learn to be like Joe. So if you're like Bob now, no worries, because it doesn't take much to learn and become effective and dangerous in PowerShell. Now let's get to this Nugget.


This Nugget, I'm going to give you more reasons to learn PowerShell. If that wasn't reason enough, we'll take a look at many more. We'll also define what PowerShell is, and then we'll get a bird's eye view of the entire course to see all the things that we're going to cover.


And we'll also get you familiar with our lab and demonstration environment, the Virtual Nugget Lab. We've got a five-machine network at our fingertips ready to go that span many versions of PowerShell and many versions of Windows. I'm excited to be your host.


Thanks again for joining me. Let's jump in. Let's make the case for PowerShell and start with a simple question. How do you currently perform and automate tasks across some of these common areas such as Active Directory? We just saw an example of Bob and Joe.


But let's say that you were tasked with creating a bunch of users or maybe had to move users around, or migrate users, or maybe you had to change some attributes of users, or join a computer to a domain. If you don't PowerShell, the answer to all those is probably the GUI.


Here's another one, the file system. How do you currently create and manage those directory structures for things like reports and backups? How do you archive that stuff? If the answer is by hand, I'm sorry. But it's not going to be after you learn PowerShell.


Also another one here is for personal use. I'll give you a good example. I've got a network-attached storage device here that has 15 years worth of photos and videos from the family, right? They all have iPods and iPads and phones and any time they upload anything, my only requirement was put it in the year directory for the year that it is.


So I've got 15 directories that span 15 years over two and a half terabytes of data and everything has the default name, dsc9384.jpg or dot mpg or whatever. And I just let it go. I'm like, whatever, some day I'll get to that. Well, once I got some PowerShell skills, I'm like, you know what, this is going to be easy.


It took me an hour to write a script to organize all that, appropriately name it, now anybody can find exactly what they're looking for. And that was a super fun one to build. What about server an operating system stuff? You know, those common everyday things that we do as administrators, like manage processes, services, event logs.


Do you do that through the GUI? Probably. And you probably even do it on a machine by machine basis. PowerShell can help us out immensely in all those areas. What about-- and here's a really good one adding and removing features, roles and features. Let's say you've got three servers, and they're all going to be Hyper-V servers.


How do you get Hyper-V on those? Would you log into each one individually, walk through the Add and Remove roles and Features Wizard? Probably. That sounds like half a day of work getting three Hyper-V servers up and running, right? With PowerShell you could do it in minutes.


One command is literally a one-liner to do that. And you could send that command to all those machines and have them fully configured in no time. Pretty cool. Speaking of Hyper-V, virtualization is a big deal these days, right? But it's also a big time sink.


If you don't know PowerShell, you're probably spinning up your environments by hand, and I can tell you from experience here being a trainer, I'm constantly spinning up virtual environments. And doing it by hand used to take forever. Doing it with PowerShell?


Not only does it not take is long, but it's repeatable. So if I ever need to respin up that environment, I just run a script, boom, there it is. There's my network at the point exactly where I wanted it. And in fact, I did that for our Virtual Nugget Lab, spun up a network.


Changed the computer names, brought up a domain controller, added all the machines to the domain, did a few configuration points, and now if I ever need to get us back to that starting point, I just run the script. What about server applications? How you manage and make configuration changes in things like Exchange, SQL, Systems, and our SharePoint?


The list goes on and on there. The answer is probably the GUI. You're go into to the GUI, find what you're looking for, you make the change. But the problem with the GUI? It's not repeatable. What if you need to do it again, and again, and again? You're back inside of the GUIs.


So PowerShell is great, because it lives outside of all these things. It's one tool to rule them all, and this is just a small example. Small small, small example of some of the things that we can do with PowerShell. How about a top 10 list? The top 10 reasons to learn PowerShell.


Ready? Go. Number 10, it's easy to learn, really. It is incredibly easy to learn. Jeffrey Snover, the man and the myth, the legend behind PowerShell, somehow took the essence of the GUI and brought into PowerShell. And this is why GUIs are good, right?


GUIs are good because it's what we're used to, number one, but they're also easy to learn. Once you learn something in one GUI, you can carry it over to the next. So the first time you learned how the X button to close the window, or the Minimize button or OK, Apply, Cancel, once you learn all those, you can carry it over to the next GUI.


So it's efficient for learning how to learn. PowerShell is the same way. Not only will you be learning quickly, you'll be ripping off commands across your whole network in no time, but you learn how command-lines work, the structure, the syntax, the convention, you carry that information over to the next command-line.


So whether you're working Windows, or SQL Server or SharePoint, it'll just be learning specifics about those command-lines. And we'll talk a little bit more about this, how it's discoverable and predictable, but just know that PowerShell is easy to learn.


And CLIs get a bad rap, and that's kind of why PowerShell's a bad rap because who wants to work in a text-based environment? Nobody. But PowerShell's different as you'll see. Number nine, it can be the only way. Yeah, not every single feature is inside of the GUI.


In fact, a lot of things in Active Directory and other products, you're only going to be able to access using PowerShell. Number eight, GUIs are slow and, of course, this incomplete kind of ties into number nine there. But the slow part is what I want to highlight here.


No matter how good you are at doing something in the GUI, you'll never be able to do it as fast as you can do it in PowerShell. As an example, say you were tasked with creating 100 Active Directory Users. They give you a spreadsheet, here you go. What are you going to do?


If you're going to do that in the GUI, at most, at the best, let's say it takes you a minute to create a user in Active Directory based on that spreadsheet. Enter all that data, you hit Create, and then you go to the next one, the next one, the next one.


So if it takes you a minute, to do 100 users, that's a little over an hour and a half. In PowerShell, one line of code to import those users into Active Directory. I'm not kidding. One line, so it would take you seconds. Number seven, it's actually really fun to use.


I'm not kidding. It's like you got to be careful with this stuff, because you could end up in PowerShell anonymous, right? PA. But really, once you get dangerous with this stuff, you're going to want to keep going more, and more, and more. And once you get familiar with a few commands, you get them under your belt, then you're going to want to start writing scripts and doing some incredibly neat stuff with very little effort.


So it's fun to use as you'll see. It's like it's like Pringles, you know, once you start you can't stop. Once you pop, you can't stop. PowerShell and Pringles, one in the same. Number six, you can do so much with so little. These commandlets, which are native PowerShell commands that we'll get plenty into, have a lot of power in them.


Combine that with something called the Pipeline, which we're going to look a lot at, which essentially allows us to connect commands together and pass data between commands, you'll be astounded. Half the time, again, you won't need a script to do something that you would normally need a script for.


Number five Microsoft is baking it in to everything. Almost every GUI we use today on the server side is just executing PowerShell commands under the hood. And that trend is going to continue until eventually PowerShell is underneath everything. Number four, the time and cost savings are astronomical.


We looked at this and an example of this earlier, but I mean this is the truth. Employers are going to be hiring people that have PowerShell skills over people that do not, because they're the ones that are going to help move the business forward by automating and making things repeatable.


They'll never do things more than once, because they'll never half to. They do it once, they turn it in to a script or store that command somewhere. If they ever have to do it again, they just run it, so time wasted doing the same things over and over.


Number three, it's enabling interactivity like never before. This is a big one. Here's why. Remember over here server apps? What if I had to create a process that did some kind of synchronization or coordination across some of these products, how would you do it now?


Not easily. PowerShell makes it easy because, again, it sits outside in all of these products exposed commandlets that we can tap into from PowerShell. So now all of a sudden it becomes very easy to do cross product integration. Number two, it's the Microsoft standard for automation.


Now, going forward, Microsoft's in it for the long haul here with PowerShell. So once you learn how to use PowerShell and how to automate something, you'll never need to, or even want to, do it any other way again. It's just that easy. And number one, your future is an IT professional depends on learning PowerShell.


This is the skill that employers are going to be looking for in the future. So it's as good a time as any to learn PowerShell. In fact, now is the perfect time to get into PowerShell, because it's just starting to get interesting, really interesting.


We're going to be focusing heavily on PowerShell Version 4. Version 4 brings a lot of stuff to the table. They've worked out a lot of kinks. They've added a lot more commandlets, which are going to give us a wider and deeper reach into Windows and beyond, and they've introduced a new feature called DSC, Desired State Configuration, which is going to, again, change the face of configuration management as we know it.


So now that we know why we should be learning PowerShell, hopefully, let's talk about what PowerShell is. If I had to define PowerShell in one sentence, I would call it an object-oriented command line shell and scripting language based on the dot NET framework that gives us all those benefits, everything we need to do here from an administrative perspective.


But here's the thing, this is an important keyword right here, object-oriented. Windows is an object-oriented operating system, but this term can scare a lot of people away, right? Because this is a developer term, object-oriented programming, things like classes, polymorphism, inheritance, instantiating objects.


But here's the thing. We only need to know objects. Properties, methods, events, things we'll cover when we get into objects, but this is really the magic, the secret sauce behind PowerShell is it's an object-based shell. So we can create these really elegant pipelines, pass objects, and this is why we can do so much with so little.


So again, the man and the mind behind PowerShell's name is Jeffrey Snover, brilliant guy. And his vision for PowerShell was outlined in something known as the Monad Manifesto, Monad, the name of PowerShell before it was actually renamed to PowerShell.


But his vision was essentially to give anybody, power users, administrators, whoever could tap into PowerShell here, the power of dot NET framework and the power of a developer without actually having to do any coding or development work. The rest is history.


So what is PowerShell? First up, it's a command-line shell. So it's just like command dot exe. In fact, we can run all those utilities that you're used to running, Ping, IP, config, [INAUDIBLE], all those things we can still do in PowerShell. So theoretically, you never have to open up command dot exe again.


Just use PowerShell for that kind of stuff. We've got PowerShell specific things that we can do that replaces those to work with objects rather than text. And actually, that's going to be a big part of this course. We're going to learn a lot of commandlets.


So think of commandlets like regular commands on steroids, because they're little dot NET utilities that send us back dot NET objects that we can work with passed down the pipeline to other commands or do all kinds of stuff with. Cool stuff that you will see.


Secondly here, it is a scripting language. It's very simple scripting language once you get the hang of it. We have variables. We have control flows, so once we want to start doing more complex things, we're going to break out the scripts to do so. It's object-based rather than text-based, and this is really what sets PowerShell apart from a traditional Linux shell like Bash or even the Legacy command prompt that we were talking about here.


So traditional shells output text this is the big difference right here. And that's going to make it difficult to do things like formatting and filtering. And there are tools to help us get the job done in those old school shells, like setting preferences, but it takes years to master things like regular expressions to do the heavy text parsing.


So because PowerShell takes advantage of the underlying dot NET framework and uses objects to represent data, it's going to make life a lot more fun and efficient inside of the shell. PowerShell's also consistent with its syntax and conventions, and this is a big one because, again, with those Legacy shells, people build command line utilities all the time, and there's no standard.


Again, some people may use dashes or slashes or whacks or whatever for their switches and there's no consistency across perimeters. Well, with PowerShell, you learn a commandlet, you learn a parameter, especially if it's a common parameter, that parameter's going to work the same across all the other commandlets.


And that syntax is going to be the same across all of the commandlets, so it's is very learner friendly and user friendly. Now, this next bit is probably one of the coolest parts about PowerShell. This is a Microsoft term, are you ready? It's discoverable and predictable.


Discoverable means we can easily find what we're looking for. So this happens a lot. The first time you fire up PowerShell, as most people do, they look at the screen and they go now what or what's next? Well, this is what's next. What's next is you need to find what you're looking for.


So we've got a search engine on top of everything in PowerShell called Get Dash Comman. It's a commandlet. It's a very easy to use search engine to help us find what we're looking for. And PowerShell commandlets have a really consistent naming convention that goes in the form of verb, you know, get, add, remove, clear, that kind of thing, the action that you're taking.


And then the noun, what research are you working with, service, event log, process, computer, so and so forth. So this is why it's predictable, because if a new set of commandlets come up for a product, you already know. You can essentially predict exactly what you're looking for based on that product.


It's also flexible and extensible. So comes packaged with lots of core commandlets. But let's say we're in a Windows 8.1 machine, we have it installed, and we want to remotely manage Active Directory. Well, guess what? We can download the remote server administration tools which give us access to all those Active Directory commandlets.


We import that, we work with them, and boom, now we can work with Active Directory from anywhere. And that goes for all the other server side products as well in many other areas. In fact, we can build our own modules. We can even build our own commandlets in the dot NET framework.


It's literally five lines of code set up to skeleton to create your own commandlets. It's really, really neat stuff. It's dynamic and powerful as we'll see throughout the course. It's automatable and, as you'll see, it's now everywhere in Windows. So what are we going to be doing with PowerShell in this course?


Well, I tell you, if you know nothing about PowerShell or if you know something about PowerShell, you've come to the right place. So we're going to start from the ground up, and then we're going to turn it up. So we'll start here immediately following this Nugget with installation.


I'll show you how to install it on Legacy systems, how to install it across the Enterprise. And we'll talk about what versions of PowerShell installed by default, what's supported, and specifically, where PowerShell 4 is supported and what the requirements are.


Then we'll get started. Here we're going to get familiar with our tools. We'll get familiar with the ISE, the Integrated Scripting Environment, as well as the shell itself, the old command-line shell. Those are the two screenshots we saw in the previous screen.


And we'll get familiar with get command. So we're very familiar with how to use that search and define exactly what we're looking for. Then we'll get into the Help System, a very, very incredible and dynamic help system that will make it very easy to learn what all these commandlets do, everything from the syntax, to description, to examples.


And we'll take a look at all different ways we can use that wonderful Help System. From there, we're going to get into commands. So here's where we're going to learn all the terminology in PowerShell. What's a command? What's a command level? What's a function?


What's a script? What's an alias? So all those components that make a PowerShell, all those things we'll be working with we'll define there. We'll also get familiar with syntax, and we'll talk about some of the common commands that you'll be working with every day inside of PowerShell.


From there, we'll get into objects. We'll define what an object is. We'll see why they're so critical to understanding how PowerShell functions. And we'll even look at something called get [INAUDIBLE], which allows us to interrogate an object to see everything there is to know about it.


We'll get into pipelines. You've got to know objects before pipelines, because pipelines are how we're going to take data that's returned from a commandlet and pass it down the pipeline. And do some more with it, filter it, format it, sort it, transform it, or maybe just do something with it, right?


So big look at the pipeline, and we've actually got a couple of Nuggets on the pipeline. One to get introduced to it, one to go deep down to understand how objects are passed around the pipeline. From there, we're going to get into providers. And providers essentially allow us to take an underlying data source and make it look like a file system.


So everybody's familiar with the file system, right? You've got directories, subdirectories, subdirectories, and files. While providers abstract that underlying data source to make it look like this, so we can map a drive to things like the registry and make the registry look like a file system, which will make it very easy for us to work with.


We'll also get into Windows Management Instrumentation and the Common Information Model, which will allow us to tap into the functionality of the operating system. We'll be using that quite heavily, too. It's a great way to get and extract information out from the operating system level.


And, again, even tap into and utilize some of that functionality at the OS level. We'll get into remoting, which is how we're going to execute commands across the network. We've got other ways to do it, but this would be the best and most secure way of doing it.


So if we want to execute, send commands, PowerShell commands, over to 100 machines, we can do that. And all those commands will get executed on those machines. And we'll get the results sent back to where we're running power, so on the client machine, really, really awesome stuff.


We'll get into automation. We've got background jobs, which are way to run long running tasks in the background, as well as scheduled jobs for automation. We'll get into scripting. We've got a bunch of Nuggets on scripting to get familiar with how to write scripts.


And at the end here, we're going to look at Desired State Configuration, which is that new feature in PowerShell 4 that is just absolutely incredible. Jeffrey Snover called this the "make it so feature." Essentially, this stops configuration drift. Configuration drift is one of those things that happens over time.


People fight fires, they change settings, and they don't put them back. And eventually you have a system that is completely different from the state that you wish it to be in. So Desired State Configuation allows us to declaratively define what a machine should look like as far as configuration, settings, features, all that stuff.


And then if those ever change, Desired State Configuration, after a set amount of time, will put it back to normal. Really powerful stuff, and it goes way beyond that, and that's what we'll dig into in those Nuggets. And we'll also, at the end here, throw some challenges your way, and along the way, we'll do some really neat real-world stuff.


So here's the Virtual Nugget Lab. This is the network that we're going to be working with. And you can have access to this network as well. If you're a premium subscriber, you can fire it right up from the course page right through your browser and have access to this five machine network.


And we're going to be doing a lot in here. So we're going to start small just working with one or two machines, and then by the end of this course, we'll be sending commands in automating things across the entire network. We're going to do some pretty cool things.


So we've got DCNUGGET. This is our domain controller. FSNUGGETs are file server. APPNUGGET is going to be kind of our everything else. We'll eventually get IS on here. We'll write and automate some tasks to run across the whole network, gather some information, create a web page, put it on IS, and we'll use Desired State Configuration to make sure that all those features stay in place.


Really cool stuff. We're going to, like I said, go from zero to hero here by the time we're done with this course. And then we've got some client machines here, a Windows 7 client and a Windows 8 client. Now let me introduce you to the network we're going to be working in.


There it is. This is actually our domain controller here. In fact, let me bring this over. There we go, all right, cool. So here we go. Here's DCNUGGET, here's our File Server Nugget, Windows Server 2012 R2 on those. Here's our other server. So we have three servers here all with Windows Server 2012 R2.


And we've got two client machines. Here's our Windows 7 client and here's our Windows 8 client. So right now, we've got all the default installations of PowerShell, which means we're fine on the server side and even the 8.1 side. In fact, we can see this.


Let's just fire up PowerShell here and let's just run a quick PS version table. Don't worry about this if none of this make sense, we're going to get into it. So there we go. In fact, in our installation Nugget, it will get you very familiar with PS version table.


We'll do some pretty cool things with it. So PowerShell version 4 right here, so we're good there. But if we head over to our Windows 7 client, and we try that out, you can see that we're running PowerShell Version 2. So this is something, an older Legacy machine, something you'll probably come across in the real world.


If you have a lot of older clients out there, you'll need to get them up to PowerShell 4 if you want to take advantage of some of these cool features. So we'll look at how to do that in our Installation Nugget. In this CBT Nugget, I welcomed you to Power Shell 4 Foundtions, and hopefully made the case for why we all need PowerShell skills here going forward.


It's going to make us more efficient. We're going to be able to do things that we ever thought possible before we're going to be able to easily manage, configure, and automate our environments. We also defined what PowerShell is. It's an object-oriented command-line shell and scripting language based on the dot NET framework.


And then we went over what we're going to cover in this course, which is all the foundations and beyond of PowerShell 4. And at the end here, we got familiar with the virtual environment that we're going to be working with for all of our labs and demonstrations.


I'm extremely excited that you're joining me for this course. So again, thank you. We're going to have a lot of fun. We're going to learn a lot, and you're going to be extremely effective with PowerShell by the time we're done with this course. I hope that this has been informative for you, and I'd like to thank you for viewing.

Installing PowerShell 4.0

Getting Started

Getting Help


The Pipeline


Extending the Shell

Extending Objects

Formatting Output

The Pipeline Returns






Scripting - Getting Started

Scripting - Essentials

Scripting - The Real World

Desired State Configuration - Getting Started

Desired State Configuration - Making it So!

Tips, Tools, and Resources

Please help us improve by sharing your feedback on training courses and videos. For customer service questions, please contact our support team. The views expressed in comments reflect those of the author and not of CBT Nuggets. We reserve the right to remove comments that do not adhere to our community standards.

comments powered by Disqus
Entry 6 hrs 22 videos


Training Features

Practice Exams
These practice tests help you review your knowledge and prepare you for exams.

Virtual Lab
Use a virtual environment to reinforce what you are learning and get hands-on experience.

Offline Training
Our iOS and Android mobile apps offer the ability to download videos and train anytime, anywhere offline.

Accountability Coaching
Develop and maintain a study plan with one-to-one assistance from coaches.

Supplemental Files
Files/materials that supplement the video training.

Speed Control
Play videos at a faster or slower pace.

Included in this course
Pick up where you left off watching a video.

Included in this course
Jot down information to refer back to at a later time.

Closed Captions
Follow what the trainers are saying with ease.
Garth Schulte
Nugget trainer since 2002