Top 3 Reasons to Learn PowerShell

Overview

In this video, speaker and author Mark Minasi walks us through his top three reasons why you should learn PowerShell.


Mark Minasi on PowerShell

There are probably three reasons to learn PowerShell. First of all, if you just want to create a user account or stop a service or something, doing it from the GUI is way faster than figuring out the PowerShell command. Once you’ve figured out the PowerShell command, though, a lot of times we as IT pros have to do the same thing over and over and over again, configure 27 web servers or something like that, and you want consistency. The great thing about PowerShell is you can cut and paste text, so you can do it over and over and over again. That’s the first value.

The second value is, that once you’ve expended that time once…OK, it was three hours to figure out the first time, but it’s five seconds afterwards. The second thing, though, along those lines is the boss is constantly saying, “Did you document what you did? Are you just documenting it?” If everything you do in PowerShell, you copy and paste it to Notepad, “Here’s the documentation, boss.” It’s documentation that runs itself. What it means is, you can rebuild the system in almost no time at all.

By the way, 2A is, they do these salary surveys on a regular basis about what IT pros make in the Windows world versus the UNIX guys. UNIX guys make like $10,000 a year more than we do. You know why? It’s because they’re not clicking; they’re working in the black screen, and the command line stuff. They don’t have that “C: /users/>.” Oh no, no, no. They’ve got a prompt like “percent sign” or “dollar sign.” Which is odd, because you’d think if there was an operating system that had a dollar sign as a prompt, it’d be Windows.

And so, the boss goes by and they’re typing “awk” and “troff” and “grep” and “LS,” and the boss is like, “I couldn’t do that stuff. We’ve got to pay these guys some more money.” With PowerShell, you can look really, really cryptic, so that could be more money.

The third reason is, there are times that you have to say…It happens maybe five times a year, maybe twice a year. You’ve got a complicated problem. Find everybody who meets this criterion and delete them. Or unlock them, or whatever. And in the VBScript days, that was three days, a lot of prayer, and a lot of sweat.

In the PowerShell world, we write a one liner where we’re taking one command; that’s where we find the victims, and we feed them into the slaughter trough, or whatever it is. The filter and the hammer. And once you’ve done a few of those…When I’m trying to do this, what I do is, I used to try to teach PowerShell. That was a big mistake. What I do now is, I try to teach how to administer your A.D. using PowerShell. By the way, you end up learning PowerShell in the process. It’s the simplest thing in the world to learn to glue them together.

And by the way, that was 3. 3A is, and this is important: Microsoft has this thing they do, where once they decide to PowerShell-ize something…Exchange was first, and then one of the System Centers, and Virtual Machine Manager, Active Directory…This thing happens where once they get the PowerShell religion, by 15 percent or 20 percent of what you want to do, you can only do with PowerShell.

If you want to turn on the Active Directory Recycle Bin, which is an awesome feature, the PowerShell command is longer than me, and you have to learn that much PowerShell. The Active Directory recycle bin appears. Wonderful stuff. Undelete users? Only works with PowerShell.

I’m not an Exchange guy, but teleport an Exchange guy into this chair, and he or she could give you 15 great Exchange things you can only do with PowerShell. So to a certain extent, going to give you reason 3B is, resistance is futile. We will assimilate your technology. If you want to be an A.D., if you want to be an administrator, you have to at least learn PowerShell to do that kind of stuff.

Oh, and in the end analysis? Once you are comfy with it, and it’s so easy, that’s the thing. OK, this is 4. I told you 3. No one expects the Spanish Inquisition!

So, the fourth reason is, PowerShell is an administration tool where, watch that first step, it’s a lulu. But what I do when I’m teaching people is, we spend forever on “Get ADUser,” which is the first PowerShell command. Once you’re past that [snaps fingers], we are blasting through the rest of the commands.

Summary

Because like, oh, remember the -confirm? Yes, it works like here, too. And remember the -what if? Works here, too. And oh, by the way, remember the dash…? And this is how we find the positional prompt? All that stuff just falls into place. You spend an hour on your first PowerShell command, and 15 seconds on all the others.