- Altaro
- DOJO
- SysAdmin Podcast
- The Power in PowerShell | The SysAdmin DOJO Podcast
The Power in PowerShell | The SysAdmin DOJO Podcast
The Power in PowerShell transcript
Andy: Hi everyone. And welcome to the very first episode of the DOJO podcast. My name is Andy Syrewicze and, in this podcast, our goal is simple. We’re going to be talking with industry experts and thought leaders to provide you with actionable, real-world knowledge that will allow you to become the IT black belt within your organization.
We’ll cover topics that range from Windows Server to Microsoft Azure to Office 365, VMware, Automation and lots more. So today’s episode, we’re going to sit down with Mike Bender. Who’s an author/evangelist with Pluralsight to talk about PowerShell from a junior administrator’s perspective. What it is, why learn it, resources to get started, and more coming up next on the DOJO podcast.
Well, everyone, welcome back to another episode of the DOJO podcast. The podcast designed to teach you the special skills needed to succeed in the world of IT. I’m your host, Andy Syrewicze, and with me, I’ve got a good friend of mine Mike Bender. How’s it going, Mike?
Michael: I’m doing great Andy.
Andy: Hey Mike, it’s great having you on the show here, you know I know you’re going to be a regular contributor.
We’ll see you on the show from time to time and talking about, you know, certification PowerShell, like today’s topic. But for the folks that may not necessarily know who you are, can you kind of give us a quick introduction of yourself.
Michael: Absolutely. So for those of you that don’t know who I am, I’ve been a teacher for probably going on two decades.
I used to teach at a community college around here, Madison College. I worked for Microsoft for a while. I was a Cloud Developer Advocate. I worked on Rick Claus’s amazing AC Ops team over there in DevRo. Now I work at Pluralsight, I’m a full-time author at Pluralsight. So, I build content for our platform, both video content. Me and a couple of my internal authors just finished an amazing series on AZ 104 for getting certified on Azure.
I’ve got a number of courses on PowerShell and some Windows Server stuff, do some labs stuff. So yeah, just kind of all-around teacher of things. Trying to help people to level up their career, that sort of thing.
Andy: Yeah. I, kind of love that saying, you know, level up your career. Cause you know, at least from my world, you know, I’ve been playing video games since I was a kid. Right. So I think that kind of, I think a lot of IT pros can kind of identify with that. And, you mentioned you you’ve been a teacher for a long, long time, and you mentioned your Pluralsight courses. You know, I’ve, I’ve seen some of your courses and they’re amazing. You do an amazing job.
You know, for those of you that haven’t seen them, I highly recommend them. Mike does a great job, you know, laying out the problem, the solution, the how-to, and everything in between. So hats off to you on all your coursework there my friend.
Michael: Thank you. Appreciate that.
Andy: Not a problem.
Michael: Always. Good to hear, hear that I’m doing a good job.
Andy: Oh, you are. A fantastic job. Absolutely. Well, hey, you know, speaking of PowerShell, that’s what we’re talking about today. It’s always a fun topic to talk about and, I think about your kind of your entry-level IT professional, looking at PowerShell or their careers for that manner, kind of coming into IT for the first time, maybe sitting down in an entry-level you know, helpdesk role, or maybe, maybe they’re just, just getting started as a junior administrator.
And again, looking at ways to level up their career right. PowerShell often enters into the conversation. For those people that are really new, how would you describe PowerShell? I mean, I know the the blanket response, that I’ve always given and that is a easy to learn you know, verb, noun, syntax, scripting language that you can basically use to do anything and all your core Windows Services in the ecosystem, but, what’s kind of your take on the definition of PowerShell.
Michael: So if I were to go to the PowerShell team, the docs.microsoft.com, I’ll put up PowerShell is a modern command shell that includes the best features of other popular shells.
That’s kind of like the start of what PowerShell is and really what PowerShell is, is it the number of things. It’s first and foremost, most people see it as a command-line interface. So it’s a way for you to in-real time run commands against the local system or on a remote system. It’s also a scripting language.
So it can be used for doing one-to-one, one to many, creating scripts. And the one that a lot of people kind of forget about because it’s not talked about as much in the lower levels is it does configuration management. So with desired state configuration, it allows you to basically configure using that concept of treating your servers like cattle, instead of treating them as special little animals is that it allows you to say, Hey, I want a hundred web servers, and I want them to all look like this. That’s what DSC does, a PowerShell desired state description. The biggest. So a couple of big things that I didn’t add into there that’s super important when we’re talking about PowerShell, PowerShell is built on top of .net.
So what that means is, and how PowerShell is different than say Bash on a Linux platform and most Linux shells, is when you’re dealing with Linux command line, it’s text in and it’s text out. With PowerShell, you’re dealing with .net objects. So the input and the output are objects, and some people are being like, Hey, you know, what does that mean? What does an object mean?
Let me put it to you this way. Let’s say we have a command and it’s called get dash automobile. You’re in Michigan. Big car place. So and what does that do? It brings us all a big, huge list that we see on the screen of automobiles. And it tells us the type. Maybe it’s a sedan, maybe it’s a pickup. Maybe it’s a compact SUV. Color. All-wheel drive. Rear-wheel drive. Each of those items is a property and that’s part of the object. So every output that you get from a PowerShell command, it’s basically like this little bundle of knowledge that has properties.
It’s like, oh, Hey, I got a 1979 Corvette that’s got a whale fin and it’s white. And it’s got this horsepower in that, but then I’ve got a, I’ve got a 1980 Civic. So all of those properties are parts of that object. And the beauty of it is that you can work with those, right?
So let’s take this same example get bash automobile. It brings me back hundreds of automobiles. Let’s say, I just want the white automobiles from that list. PowerShell has what’s called the pipeline that allows you to change the command. So I take the output from get dash automobile. I sent it into the pipeline and send it down to the next command. And in this case, I could do something like select dash object, where the color is equal to white.
The output from that is going to be all of the objects. Automobiles which are white. So PowerShell with the command, being that it’s object orientated, the fact that you can string multiple commands together really allows you to be able to do a lot, not only from a, just finding out information. In that example, you saw, I went from a general list of a bunch of automobiles, down to a more granular list. It also lets you do actions.
So the common one that we often use and is great for entry-level, you know, Hey, we’re having a problem on a server. It’s not printing. Let’s check to see if the printer service is running. You do a get dash service, go against the computer name of the server. You can select out all of the, you know, the objects you want to see what properties you want. And if you’re simply like back in the old days, what did we do whenever we, we had batch files that did this back in the old day is so-and-so printers not printing, hit the batch file for that printer or for that server. What does it do? It restarts a service. So I can, I can skin that cat real easy. I can do get dash service dash computer name, put in, say it’s DCO 1. Pipe that into start dash service with the service name being the printer service and then boom. So that allows me to take the input. So what I did is I took the input from the first command. Or the output. And I use that in the second command to be able to string those together.
So I know that’s, I just basically blew through 20 minutes of, Hey, here’s how PowerShell in about, in about three minutes. So plenty of stuff to unpack there.
Andy: Yeah, definitely. No, it’s, it’s a good example. I really liked your, your car example. I’m going to have to put that one in the holster for my own use in the future. And you know, if you don’t have it trademarked or anything, but I think it’s such an apt example, because like you said, we can return a list of objects, filter that list of objects and then pipe it to actually do something with it. Right.
And I made it could be as simple as, you know, doing it, like you said, on a one-to-one basis or… you know, I think the most complex script that I’ve ever used PowerShell for was to basically automate the deployment of a virtualized “data center” on top of a Hyper-V cluster that included a domain controller, a file server, an RDS server and it automatically provisioned the domain. It automatically joined the machines to the domain using you know PowerShell direct with Hyper-V. Basically did this entire deployment that manually would take, you know, two, three hours and did it in basically as long as the limiting factor was the speed of the discs when it was doing the copy and the discharge, and right.
So, I mean take these, you know, historically would have considered to be very complex tasks and bundle them up into a simple script. Right. And I that’s, again, that’s like one of the extreme examples, but definitely. Yeah, definitely good example there. So, you know, I guess that kind of leads into the question again, putting myself in the seat of kind of an entry-level administrator. We’ve kind of talked about what PowerShell is, what it can do. You know, if I’m an entry-level administrator, why do I care?
Now selfishly, if I put myself back in my own seat, back when I was an entry-level administrator. I’ll take any tool that can help me automate and make tasks easier. I think back to one of my very, very early system administrator tasks. My first IT job was for a K-12 school system.
And I don’t even remember what we were changing in AD. So we were, we were modifying AD. We had to touch every user count in AD. Like I said, I don’t remember the exact object or what we were changing, but you know, this is a K-12 school district in Michigan. It’s a class C school. I don’t know if that’s the same from state to state, but we’re talking oh, seven, eight hundred students.
So seven to eight hundred, you know, user accounts. And so at the time entry-level administrator, yeah, you touch every account manually and make that change. It was not fun at all. Now, you know, fast forward to today, you know, if I’d known then what I knew about PowerShell and PowerShell was available then. I’m kind of dating myself a little bit there.
But you know, PowerShell could have done that much more quickly. Right. So, from your point of view, Mike, why would you say to that entry-level administrator why should they learn PowerShell?
Michael: You know, you hit on it. You know, automation is a big thing because in this day and age, that’s going to be kind of expected on the job, is that that knowing how to do these automation things and knowing how to do those automation things is going to give you yeah, depending on the organization you get into, that’s going to give you a leg up on other people out there. Because as much as you know, everybody thinks everybody knows PowerShell. That is not the case.
I talked to a lot of people and a lot of people watch my course on Getting started with PowerShell. So there’s, there’s a lot of stuff to learn. So from the automation point, it’s, it’s, it’s really important. You know, the other reason I think it’s important is that even for administrators, everything’s changing and we have no idea what this career is going to look like in 10 years, much or five years.
Right. What I can tell you is going to be a part of it is more code. So PowerShell, I believe, and I’ve debated people on this all the time, that’ll be like, oh, I can’t understand PowerShell. I’m like verb dash now. Like, okay, you’re writing Purl. Anybody who’s worked with Purl. I mean, Larry Wall was crazy and I probably, you might want to cut that because I’ve probably just, you know, put a, put a sign on my back, but Purl is not a fun language.
Where PowerShell is a good entry-level language, especially for Windows, administrators, to be able to understand things that they know. They know what a service is. They know what a computer is. They know what a process is. And if you’re working in Active Directory, the easiest way to work with Active Directory and to get info out of Active Directory is PowerShell.
So for those that, you know, what I often would tell my students, I’m like, I’m like, well, here’s an example of why you should use PowerShell. Let’s say your boss comes to you. You work for a company. You’ve got multiple geographic locations. You’ve got thousands of employees. And your boss comes to you.
You’re running Active Directory and they’re like, Hey, I need to know the names, addresses, common set of specific set of information that you have in Active Directory for every user for all of the users that are in a specific group or in a specific geographic location. If you were to do that manually, it’s going to take you forever.
If you do that with PowerShell, it might take you five to 10 minutes depending on what your skill level is. But what that means is that 20 minutes later, you can go to your boss after you finished the thing in five to 10 minutes with that CSV file of all of the information that he needs and be like, here you go.
And now you look like a rock star for something you did in 20 minutes, but you actually did in five and 10 and you’re like, oh, okay. So that’s for me, that’s really, the biggest thing. I think it’s a great way for people to really get into the world of code and get getting to understand that.
If you didn’t have code as part of your learning process, whether it be in your schooling or wherever it was that, you know, it can be kind of challenging getting to understand, you know, what for-each do. What what do loops do? You know, those sorts of things, that type of logic and PowerShell’s really, I think, a good entry-level way for people to work with it. And the beauty of it, the fact that PowerShell is cross-platform. So you could run PowerShell on a Mac, you can run it on Linux desktops. The big caveat that’s important is that you have what’s called Windows PowerShell, which is built into Windows systems.
Which is no, is still part of Windows, but it’s no longer, what’s the proper word. It’s no longer, they’re no longer putting features into it. It’s feature complete. Whereas PowerShell 7, or what used to be called PowerShell Core, is basically what anybody from Microsoft, when they’re referring to PowerShell, they’re referring to PowerShell 7 and above. That’s the one that’s cross-platform.
And while the team is making progress to have the things that run in Windows PowerShell, cause there’s specific commandlets and commandlet is a PowerShell command that you can run. It’s either a function or, I’m forgetting the other term for it, a function, or it’s a, you know, basically a wrapped .net executable. And you basically, you run it and it performs as specific action.
There’s different ones because Windows systems are different than Macs and Linux. So you can’t run get that service on a Linux system because they don’t have the services in the sense of Windows. That’s a big thing to keep in mind when you’re going cross-platform, is that yeah, you could run those on each of those, but what you’re going to be able to do is a little bit different, but PowerShell’s PowerShell.
You still have, everything’s still object-based. It’s all really pretty much the same. So it’s just, just a matter of what are the things that are available for you to work with. And, you know, that’s really, the key with PowerShell is, you know, how do I start working with PowerShell? But that’s what that’s where most people get, get tripped up.
Andy: Right. Exactly. Yeah. I’ve seen that quite, quite frequently is, they’ll start trying to use it and they’ll struggle and wonder what they can do with it. I’ve often found that, you know, take one of your everyday tasks that you do every day. You know, that’s mundane and challenge yourself a little bit. Try to automate that task or process.
Just something simple. See what you can automate. Just, just to get used to the language, right? That would always be some of my beginner’s advice to start learning it. So, you know try to solve a problem that you’re dealing with. Something that you’re familiar with. You know, that familiarity helps you learn the language.
So, and one thing I wanted to really quick I want to back up to the Purl comment because I’ve got a great story to tell based on the whole Purl discussion. I, so this would have been back at Microsoft Ignite 2019. The last time Ignite was in person, of course, you know, pre COVID and I was actually interviewing Jeffrey Snover for a video like this one. And you know, again, for those junior admins out there, Jeffrey Snover is largely credited as the creator of PowerShell. And it’s funny. He made a joke about Purl in that interview. What were we talking about? We were talking about one of the new announcements at Ignite that year.
I think we were talking about Azure Arc briefly just about the management capabilities of Arc. And he mentioned the joke was you know, an administrator had a management problem. So he made a Purl script and then he had two management problems.
Michael: Yes, it’s still true. Yeah. I mean, we, the, the first company that I ever worked for, all of our monitoring was based on Purl scripts and they worked flawless until the build team. Every time they created a new build, they updated the version of Purl. So if you know anything about Purl, it’s all dependent on the version that’s on the box that you’re running this stuff on. So as soon as you change the version, it breaks everything.
Andy: Everything’s broken.
Michael: So, yeah.
Andy: I will, I will say you know, more specific to PowerShell, there seems to be a lot less of that, virtually none of that, in PowerShell with the one exception being like you mentioned already kind of that split between Windows PowerShell and PowerShell Core, PowerShell 7. And now for those that are familiar with PowerShell 7, you can actually go out to the PowerShell 7 github page to download that current version.
And I’ll actually link that in the show notes below this video so you guys can, you know, don’t feel like you have to scramble and Google for it right now. Well, you can, if you want, but I’ll put it in, in the show notes below this so you can just click a link. So, alright, you know, so we touched on this a little bit already, Mike, you know, as far as, you know, kind of tips for learning it.
And I mentioned, you know, the whole, Hey, try to take a task from your everyday life and try to automate it. Would you have any tips for learning PowerShell? I mean, there’s, you know, like you said, your, your course that you’ve done on PowerShell, are there any other you know, resources that you would suggest people take a look at to get started with PowerShell?
Michael: You know, the most important thing is that there are three commands you really need to know get dash command, which allows you to search the commands that are in the box. So take Andy’s examples of learning to automate something. How do you know what the, what the commands are that you can actually use? So let’s say you got to firewall example.
You could do a get dash command. You could look for all of the commands that include firewall. You could do *fire asterix*, and it brings you an output. And then you just go down and you look at those. Once you have the command, then you can use get dash help. So what’s the, you know, you let’s just start with something easy to get that service and you want to know how to use get dash service you type in get dash help space get dash service and it lists all of the help files that are built into Power Shell for that. Here’s an important two-way command update dash help.
So anytime you have a new instance of Windows PowerShell or PowerShell, always run update dash help dash force to update it because what ends up happening is that Microsoft doesn’t ship all the help with it. What it does is it goes out and it pulls all of the latest info. So when the PowerShell team and people in the community change, or make updates to the documentation that allows you to bring that down. So using those help files allows you to learn how to use the commands, so you can find out, okay, what parameters work with get that shell. So what a parameter is, is it allows you to be able to specify things like the name of the service that you’re working with, the status of a service. So it’s like dash name. You can put the name of the service, and if you did get dash service, dash name, it pulls up just that that service. So a parameter has values that go in there.
And there are actually some parameters, like I said before dash force that don’t have a value that go with it that simply perform something. So you work those all together and then there’s another command. We don’t have time to really dig into it, it’s called get dash member. And what you can do with that is that if I do get that service and then I pipe that into using the pipe on your keyboard, get dash member.
Remember we talked about objects and properties. This will display for you all of the properties that are associated with that command. And it tells you how that information comes over. So the objects don’t just come over as text, you might have strings, you might have, integers and you could get really, really complex with that.
But with those three commands, what it allows you to do is it allows you to investigate. When I taught PowerShell, the number one thing I taught people, don’t go to Google. Because you never know what version of PowerShell anybody is that’s using the scripts that are out there and look in the console, because that’s where you’re going to find all of the information.
And then once you’re comfortable with using all of those, then you’re really going to be comfortable with PowerShell. So that’s really a great way to get started. So as far as resources and I’m sure Andy will put these below, in this show notes is really the number one resource is going out to docs.microsoft.com forward slash PowerShell, which is going to take you to the PowerShell documentation and that, and for anything Microsoft, if you ever talked to me or Andy, or pretty much anybody, that’s, that’s really the place to go for documentation for, for anything Microsoft. So that’s a great place to go. I know that I know a number of the people on the PowerShell team, along with the documentation team, and they’ve been spending a huge amount of energy lately really updating their documentation.
And they’ve got a lot of great information. Also, Microsoft Learn has a new PowerShell course of getting started and learning PowerShell. That is really, really well done. You could take a look at those. You know, I don’t normally get everywhere. And you know, I’m not a marketing person, so I don’t always, you know, show my courses and stuff like that.
I think it’s a really good course for getting you started. We also have some other great courses by people like Jeff Hicks on Pluralsight. So we’ve got a tonne of content. You know, you could probably find stuff on YouTube. If you’re looking for the free sort of stuff, but I always find YouTube is you get what you pay for sometimes.
And sometimes you can’t get that time back. But I think starting out with the documentation. Finding some great videos. And the last thing I’m going to put out there is there’s a great book out there. It’s called PowerShell in a Month of Lunches. That really is the guide that many of us have used over the years to learn PowerShell and the techniques that you’ll see in my courses that you’ll see in other people’s courses, that you’ll see taught by people in the PowerShell team, is the same methodology that’s built out of the original book that was done by Don Jones and Jeff Hicks. That’s now I believe in its fourth version and they’re there, the latest version is going to include Mac and Linux. So the it’s more PowerShell 7-ish, then the last was a more Windows PowerShell-focused. So those are some great resources for you. I would just say, get started using it and see what you can do.
Andy: Yeah, definitely. That, that book is a great resource. That’s, that’s how I initially learned PowerShell and he’s one of the authors on the DOJO is Luke Orellana. Fantastic PowerShell resource. He’s my go-to guy whenever I have a PowerShell question that I don’t know the answer to, and that’s how he learned PowerShell, you know? So it’s like, you know, that’s like the definitive getting started book for PowerShell. It’s fantastic resource.
And then real quick, before we end the show, I want to back up really quick to get help. You know, that commandlet that Mike, you were just talking about. My personal favorite commandlet because I’m horrible at remembering, you know, syntax for certain commands. You know, if you’re like me and that the viewers out there listeners out there, if you’re like me and you learn best by you know, by seeing an example, my favorite parameter for the get help commandlet is dash examples. And it will give you a number of different examples of that command line in use, what that example does all the various, you know, switches and parameters. And that’s I bet you, I used that once a day, at least.
Michael: Yeah dash examples is great because it all, and the way they have it set up is awesome because it goes from the most simplistic usage of the command to super complex. And some I’ve seen some commands that have like 15 examples and I’ve seen some that have like two and it’s all based on the author, the team, you know, whoever came up with the help for that.
But yeah, that, that’s a great call-out is using to get that shell name of the command dash examples. I often go straight to their bypass everything else you could go right to the example. Okay. Let’s see how that works. And going back to the old school’s way of scripting, you take somebody else’s and you retool it.
And so that’s what I’ll do often is I’ll take the help examples and I’ll retool those.
Andy: Yup. Yeah. I usually find that, you know, I sit down to use a commandlet and I’ll, I’ll strike out twice with the syntax, you know, I’ll get the red text underneath, you know, I’m like, okay, all right. Time to get the help file out and look at the example, oh, I forgot, you know, this value needs to be this or whatever, so it’s definitely, use it all the time.
All right. Well, Mike, it’s been great having you. I think that’s all we got the time we’ve got for the day. Yeah, we’re looking forward to having you on for, you know, future certification talks, more PowerShell talk and the, I can think of, you know, at least half a dozen subjects for you and I to talk about. So we’re looking forward to having you back.
So, and then to all the listeners out there, thanks for tuning in today. Or if you’re watching on YouTube thanks for watching today. Again, we’re going to put all the resources that we talked about and I’ll be sure to include them. You know, if you’re watching on YouTube, there’ll be beneath this video or depending on your podcast platform of choice, we’ll be sure to include all the resources in the description link.
Additionally, if you’re looking for more great IT resources out at the Altaro DOJO, we have a number of fantastic different DOJOs we call them. But basically they’re content areas.
So we have content areas covering Hyper-V, VMware. We cover some Office 365. We cover MSP-related content. So we talk about Azure. There’s not much we don’t talk about these days on the Altaro DOJO. If you want to check that out it’s www.altaro.com/dojo. And then from there also, we’ve got a, I’ll put Mike and I’s Twitter handles beneath this episode as well. So if you want to reach out to us, you have a question you can reach us there.
Other than that again, want to say thank you for joining the show today. Mike, thanks for showing up and sharing your insights. And we hope to see you all for a future episode of the DOJO podcast. Take it easy.
Welcome to the VERY FIRST episode of the DOJO Podcast, the podcast where we teach you how to become the IT black belt within your organization. The goal of this podcast is to bring you industry thought leaders, interesting topics, and actionable insights into the world of IT and how to become a kick-ass system administrator!
This episode features host Andy Syrewicze and guest host Michael Bender, an author/evangelist with Pluralsight and former Microsoft Cloud Advocate, to talk about how junior admins can get started with PowerShell, with resources, suggestions, and why it’s such an important skill to master if you want to progress in the IT industry.
In this Episode
- Introduction
- What is PowerShell? – 4:06
- What can PowerShell do for System Administrators – 8:40
- Why Should Administrators Care About PowerShell? – 11:43
- Resources to Get Started – 22:30
Episode Quotes
- Mike <In Superhero Voice>: “PowerShell is a Modern Command Shell that Includes the Best Features of Other Popular Shells!!!.”
- Fictional Get-Automobile Cmdlet: “I Got a 1979 Corvette that got a whalefin…”
- “Take the output from Get-Automobile…..”
- “Knowing these automation things is going to give you a leg-up on other people out there!”
- “We have no idea what this career is going to look like in 10 years”
- “An administrator had a management problem, so they made a Perl script, then they had 2 management problems”
PowerShell Resources
- PowerShell 7 GitHub Page
- PowerShell on Microsoft Docs
- PowerShell on Microsoft Learn
- Mike’s PowerShell Course on Pluralsight
- eBook on Saving Time on Hyper-V Tasks Using PowerShell
- Learning PowerShell in a Month of Lunches
- Andy’s Hyper-V Deployment Script
Have a question? Want to feedback? Send us a Tweet!
Listen to The SysAdmin DOJO Podcast on your favorite platform. Let us know what you think of it (or how we can improve) by rating or leaving a review!
Not a DOJO Member yet?
Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!
By using this site, you consent to our GDPR privacy policy and cookies policy and you agree to the use of cookies for analytics, personalised content and ads.
×No account yet? Register here
-
Access all Altaro DOJO eBooks, webinars and other members-exclusive content
-
Join 50,000+ IT Pros benefiting from free training
-
Join the DOJO forum community and ask our expert moderators your questions
Thanks for registering and welcome to Altaro's DOJO!
You will receive a welcome email shortly, as well as our weekly newsletter. Don't worry, you can unsubscribe whenever you like!