From the course: Learning PowerShell

Why PowerShell? - PowerShell Tutorial

From the course: Learning PowerShell

Start my 1-month free trial

Why PowerShell?

- Let's talk about why you need PowerShell and why you need to learning this wonderful language that you have available to you. Especially if you're an IT pro or even a developer, you're going to want to learn this language. PowerShell provides just a wealth of ability inside of your entire IT infrastructure environment. First off, why? It's a rich scripting environment, but I don't want you to limit your thinking that PowerShell is just a scripting language. It's actually a powerful shell an environment that we can do interactive commands, and all kinds of other great things inside of it. PowerShell is a language not necessarily just a scripting environment but it's one of the abilities that it offers. It does Bulk Operations so much like we do with scripting. With PowerShell we can perform the perform the same tasks over multiple servers, thousands of servers even, if need be to really perform a lot of great work and keep our work consistent across all those servers. Do a lot of the heavy lifting instead of having to go do all the manual steps through GUI. It's an Interactive Shell, so all my Linux users out there, that if you're new to PowerShell, you've had a shell for forever in your environments and how you interact with that. What PowerShell does is it provides the Interactive Shell for our Windows-based environments so we can really tell it all kinds of great things, what to do, find us information, configure settings, it does that in an interactive way and gives us feedback of what's happening and what we're actually going to be using. It's also for Task Automation. One of the great things about PowerShell, especially when we think about the configurations of servers, we can use this language to actually automate all kinds of great things inside of our environment. And then when you take it to the next step with things like desired state configuration, we can then control with PowerShell how a server is configured, does it stay in configuration and if it does drift, we can have PowerShell actually bring it back to our desired state. So, there's all kind of great things that we can do with PowerShell just from a simple Task Automation perspective. It's also Object Oriented. And what I mean here is that everything we do inside of PowerShell is treated just like an object, whether that object is a service or a process, or maybe just a server. Everything is treated like an object that we use PowerShell to describe that object, but we also use PowerShell to configure and work with that object so when you think about this in a language, pretty much everything's a noun that we're going to work with inside of it. And PowerShell just wraps around that. In another video, we'll talk about how that comes to be and how to actually read this wonderful language, but it's Object Oriented. Now this also provides a wealth of information for our developers because it's based on the dot net framework. So everything that we have is actually based in code. When you look at some of the commandlets that we're going to see, you'll see that dot net functionality come in. So a lot of developers have started using PowerShell even though you might think it's traditionally an IT pro tool, but because of what it does and how it interacts and works with objects, developers find this very native to some of the languages that they program in every day. Now what are some of the basics of the PowerShell language and things that you need to know about as we start working with this and going down PowerShell and learning it for the first time. First off, you're going to use PowerShell for consistent, repeatable tasks and the things that we want to do over and over and over again. Now I know, sometimes just looking at a service it's easy to go to the GUI and just get that information. But what if you have to do that a thousand times on a thousand different servers? You want to visit each server every time? Probably not. There's also several built-in providers. And simply, a provider are the things that we can ask questions for, that we can interact with. Remember, PowerShell is an interactive shell, and those providers allow us to work with it. So, some of the providers we have around active directory, the registry, if you're into Windows Management Instrumentation, or WMI, we can do that and we can talk to it natively. We actually use our natural language when we're working with PowerShell and I'll explain how the language works in another video. You may actually already know a little bit about PowerShell without even ever playing with it. Because aliases really give us an ability to help bridge the gap from previous languages. So, let's say for example, you want to look at what's inside of a directory. Well, you might run DIR if you're from the Linux world you might run LS, if all you've known is PowerShell, you run a thing called Get-ChildItem. So, I'll show you how that works in just a second, and give you an idea of what's happening with our aliases and we'll dig into those even more in another video. And the last thing that we want to know about PowerShell, it's built into many products. It's a shipping requirement for most of the products that come out of Microsoft's production environments, so it's really designed inside of it. It also is in a lot of third-party products. VMware has PowerShell and abilities built into it. We can do it with Citrix. We can do it with many, many other IT pro tools. So we see a lot of folks really adapting PowerShell. And in fact, PowerShell's already on to its fifth version of this powerful language. So let me just show you what an alias is really quick. And then we'll close out this video. So, let me show you what an alias looks like inside of PowerShell. I'm just gonna type in LS, it does the directory listing. DR, it does the directory listing. Well, the actual PowerShell commandlet is one called Get-ChildItem and if I just run that commandlet, hey, that's the same thing. So aliases help you bridge that gap, and oh, by the way, and we'll talk about this in another video, you can create your own aliases to make learning a language even easier for you. So as you can see, PowerShell provides a wealth of opportunity for you and your environments and you may actually already know a little bit of PowerShell without even knowing you already did.

Contents