The Surly Admin

Father, husband, IT Pro, cancer survivor

How do you start using Powershell?

I’ve been asked this a couple of times, and to be honest I’m not sure I’m the best person to even ask this question of!  Why? I’m very much a hands on learner, I often tell people that I have to learn with my fingers not with my brain.  What this means is I have to run a script and see how everything works to really understand something.  Reading from a book is all well and good, but it doesn’t “work” for me until I actually sit and try it.  That’s why in my office you won’t find many technical books–and the ones you do find I’ve almost never actually read!

I call my style of programming “hacking”.  Not the classical breaking into the Pentagon so I can change the web page type hacking, but more like trying to cut down a tree with a blunt axe.  I’ve been programming and scripting for over 20 years so the mechanics of it are pretty easy so I’m often translating:  How do I do this with Powershell, etc.  Then I bang away at it until I understand what someone else does.  Eventually I start putting all of these pieces together until I’m writing my own code (which is when the fun begins).

Powershell Basics

So fine, how do I start using Powershell?  If you’re a Windows administrator (and I’m assuming you are) then chances are you already have started using it.  Exchange 2007 and 2010 have quite a number of features and settings that are only exposed to Powershell.  That said, there are only a few commands, properties, methods, etc that you will find yourself using all the time.  Armed with those you can do a awful lot of scripting.

Powershell Discovery

Powershell is one of the easiest languages I’ve ever run into as far as self discovery goes.  There is an amazing amount of knowledge locked away in the help files and a couple of cmdlet’s–wait, what’s a cmdlet?  One of the basic building blocks of Powershell is the cmdlet.  It’s a little command that allows you to do something, such as getting all the active services on a computer (Get-Service), or copy a file (Copy-Item).   So which ones do you want to start with?


Use Get-Command to discover what cmdlets are available to you in Powershell.  Use wildcards to assist you in narrowing down your search.  I want to find out how to get and manipulate the information about the services running on my server.  Try:

Get-Command *service*

If you’re like me, that actually pulled up a very long list.  So let’s see what cmdlet’s are available:

Get-Command *server* -type cmdlet

And you get a much better looking list.  The next discovery tool might make a lot of you groan in pain, but it is really useful.


Get-Help really is one of the meat and potato’s discovery tools you’ll use.  It can often be very difficult to read, I know but all I can say is stick with it.  The other thing I recommend–and again, this is what works for me–is don’t try to digest it all in one shot.  Get the information you need out of it and get out!

Want to know how I knew about the -Type parameter in Get-Command?

Get-Help Get-Command -Full

That’s it for today.  Tomorrow I’ll show more on using Powershell to discover how to use Powershell!


September 24, 2012 - Posted by | Powershell - Getting Started | , ,

1 Comment »

  1. […] How do you start using Powershell? Powershell Discovery: Variables Get Started with Powershell: Loops and branches Powershell and the Pipeline Powershell Best Practices – Surly Style […]

    Pingback by Powershell – Steep Learning Curve? « The Surly Admin | March 28, 2013 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: