How to Learn PowerShell

As I talk with people at conferences or interact with them online, there’s a recurring theme that PowerShell is recognized as something to learn. With that said, many admit that they don’t know how to learn PowerShell, where they are often overwhelmed by the large number of commands or feel it is too complicated. I can help with the first item and the rest are easier than you might think. If you don’t know where to start, visit the Essentials PowerShell Resources page on my blog. But let’s talk about how you can actually learn PowerShell.

Understand the Principals of PowerShell

PowerShell is easier to learn than I think most people realize. I feel many IT pros have a lot of preconceptions about PowerShell or think it is all about scripting, which they view as some form of arcane sorcery. It’s not. PowerShell is a mechanism for working with the things you want to manage.
Don’t focus on how to manipulate the output. Imagine working with “things” as physical objects in a virtual space that we call the pipeline. The “things” are reflected by the verb-noun naming convention of PowerShell commands, such as file, service, eventlog, or SMBShare. Granted, some of the nouns can get complicated or include a prefix, like ADUser, but you still can understand it is a user object.
PowerShell makes it easy to get these things and do something with them by passing these things from one command to another. You can think of it like a virtual assembly line. For example, let’s say you get all the services on a computer. Now you have a bucket of services. The bucket is placed on a conveyor belt and passed to the next step where someone tosses out services where the status property doesn’t equal ‘Running’. This new bucket is passed on to another step that sorts the things by their display name. Finally, the bucket of things is sent to warehouse dock where they are prepared for delivery.

Get-Service | Where {$_.status –eq 'running'} | sort Displayname

The end result in PowerShell is a pipelined expression that you can type interactively. No scripting is required.

The Get-Service cmdlet in Windows PowerShell. (Image Credit: Jeff Hicks)
The Get-Service cmdlet in Windows PowerShell. (Image Credit: Jeff Hicks)

Now, if you wanted to use this as the basis for a more complicated command to build a report of mission critical running services on 100 servers and email the results as an HTML report, this process will take several steps. But even this task isn’t complicated to build if you mentally track the virtual assembly line. Putting the commands in a script simply means you only have to type it once or someone else can easily execute the process. I’ll admit that sometimes this process may feel more like a game of MouseTrap.
052215 1619 HowtoLearnP2
But you don’t have to play the game alone. And there’s great satisfaction in getting your contraption to work.

Learning Basic PowerShell Commands

Once you get this idea of “objects in the pipeline” in your head, you’ll want to know how to use some basic PowerShell commands. Naturally Get-Help is extremely critical. If you can’t ask for help you won’t get very far and will be extremely frustrated. You also need to know how to use Get-Member, which you can think of as an X-ray machine. The things we manage with PowerShell can be extremely detailed or complicated objects. What we see by default isn’t necessarily all there is. A lot of what we see by default in PowerShell is by design that someone at Microsoft thought would be the most useful. But you can build your own assembly line, if you will, and get the result you need. Often this requires understanding what something looks like. You might run a command like Get-Process, but once you understand what the process “things” look like:

Get-Process | Get-Member

Then you can create commands like this:

get-process | sort WorkingSet -Descending | Select ID,Name,WS,VM,StartTime -first 5 | out-gridview

The get-process cmdlet at work. (Image Credit: Jeff Hicks)
The get-process cmdlet at work. (Image Credit: Jeff Hicks)

The other commands that I think you should thoroughly understand how to use are Get-Command and Select-Object.

Your Learning Goal

PowerShell continues to grow in complexity and scale. Command coverage has simply exploded since the days of PowerShell 1.0. Not only are there new core PowerShell commands, but many Microsoft teams are now delivering PowerShell solutions. Add in third-party for support from companies like VMware and Veeam, and it is impossible for anyone to know everything. You can’t really learn PowerShell. Nobody can learn and remember 3000 commands. Your goal should be to learn how to use PowerShell. You need to be able to find the necessary commands to manage the things on your plate. You need to know how to read help for these commands. You need to be able to understand how the “things” are constructed and how to best build an assembly line to achieve the desired end result.
I strongly recommend you take the time to learn fundamentals and start small. Don’t try to build a Bugatti Veyron after a week. I am amazed how many people attempt this and then wonder why it is so difficult. You also need to use PowerShell every day, even if you do nothing but read help for a cmdlet, a blog post, or something from
I’ve been writing and teaching about PowerShell from its very beginning and have seen my share of struggles, but also my share of success stories. Learn and accept the PowerShell paradigm and everything else will follow.