Two years ago, I spent a great deal of time evangelizing PowerShell within my company and publicly as much as possible. Frankly, I felt a little bit like Paul in Athens in Acts 17:32-34.
Some sneered, but others said “We want to hear you again on this subject.” At that, Paul left the Council. A few men became followers Paul and believed.”
Indeed, I did get a few sneers, but mostly what I heard was, “We want to hear more on this subject.” I eventually took that to mean, “This sounds really great but I am not ready for it and it can’t help me solve an immediate problem need right now.”
If that was you one to two years ago, I think its time to check out PowerShell again.
I was listening to the PowerScripting Podcast the other day and Hal and Jonathan were interviewing Don Jones, a well known trainer and PowerShell MVP. During the interview, he brought up a very interesting point that I think was spot on. There are a ton of developers who are PowerShell MVP’s. These people provide a tremendous service to the community, and their input is invaluable. They have brought incredible amounts of additional functionality to PowerShell. Take a look at PowerTab and PowerBoots as just a couple examples.
However, when you go to search on the web for PowerShell, there is a ton of information that is heavily developer centric that addresses developer oriented problems and solutions. If you are a systems administrator just jumping into PowerShell. Don’t be overwhelmed! It doesn’t have to be that complicated. You don’t have to know how to write code or even script. The only thing you have to be willing to do is work with a command shell and type in commands. That’s all it takes to get started!
PowerShell was created to make the lives of us system admins easier. However, there was a design choice that the PowerShell team made up front that you will have to deal with and overcome. The first 10 minutes of using PowerShell will be a little tough. Just know that it is for the sake of making the next 10 years of your life as an engineer much easier.
Here’s the first thing to know about PowerShell, all of your existing command line tools work as expected. Here I am using ipconfig and some net user commands
So that makes life pretty simple when you get started. There are even linux commands that will work. Check out ls or cat if you’ve got a *NIX background. Things get a little (just a little) bit more tricky when you start using built in PowerShell commands, called “Cmdlets” They are called Cmdlets because they are tiny commands. Think of novels compared to novelettes. This will make more sense as you start to use PowerShell. Basically you can string a set of Cmdlets together to execute a complete command. Cmdlets are the building blocks of functionality in PowerShell.
I will be the first to admit, when I first saw a Cmdlet, I was annoyed. I saw a small stet of Cmdlets like theses:
Here’s what annoyed me. I hated that there was a “-“ in the middle of all the Cmdlets. I remember thinking that it would be hard to type these all the time. I just remember being overwhelmed by the examples I saw and thinking it would be hard to figure out what went where when I was typing in the command shell. However, I didn’t have the context and understanding of how these Cmdlets work so I hope this will help you get over the appearance of complexity.
Cmdlets consist of 2 parts. They all have a verb and a noun. The syntax is “verb – noun” All Cmdlets do something to something. Lets look at Get-Process. This Cmdlet gets (lists/shows/displays) processes that are running on your computer. This brings up another interesting point. Nouns are always singular. This is done for the sake of clarity. There is a Cmdlet called Get-ChildItem. Using plural forms of the word could cause confusion. Do you use –childs or –children? Because PowerShell is used by many people in many countries that speak many languages, the goal is to keep the naming scheme as simple as possible.
The idea here is if you want to look at processes, you know you can use Get-Process. So what if you wanted to look at VMs? You can probably guess that it will be Get-VM. In fact, there is a set of accepted verbs that should be used by people that create Cmdlets. If they have verbs that don’t adhere to the list, you should let them know.
So here’s a couple things to get started. PowerShell comes with the OS in Windows 7. If not, download it from here.
Fire up PowerShell and run some commands like you would in CMD. (See, that wasn’t so bad)
Now try a few cmdlets like Get-Process and Get-Service
Next, there are two Cmdlets that will help you discover all kinds of things.
Get-Help and Get-Command
You can also try using Wildcards.
If you are a Systems Engineer working with Windows, its time to start learning PowerShell. What are you waiting for?