Tome's Land of IT

IT Notes from the Powertoe – Tome Tanasovski

Powershell – Part 1

Start at the beginning.  Powershell can be run via:


Say hello to your new blue and white friend.  My hope is to build from post to post and teach what I learn day-to-day as I attempt to migrate from perl scripts to powershell.

Powershell retains the commands that are available in most shells like csh, bash, korn, or DOS.  In an effort to attract both *Nix and Windows users powershell is chock full of aliases that will be familiar to both flavors of the IT world.  Commands like dir and ls produce the same results, but in reality they are just aliases to  a cmdlet called Get-ChildItem.  Try typing all three commands in powershell, and you will see that they produce the same results.  In order to see a list of all the available aliases try:


This is a great place to start and look at some of the more common commands, but there’s an even more important resource that you need to become familiar with immediately: get-help, man, or just help (mind you help is a function that is equal to get-help, while man is an alias to help).  Let’s look up the help page for get-alias:

help get-Alias

Using this we can see everything we need to know about how to look up, and get information about configured aliases in your environment:

get-Alias dir
get-Alias -definition get-ChildItem
get-Alias -definition get*

You’ll notice that one lesson Microsoft learned is to provide proper inline documentation the way *Nix and Perl do.  This beginning should provide as a confidence booster that they may have done some things right.  I can tell you for certain that there are a lot more surprises in store for you, but we’ll save that for another day.  At least you now have a few resources you can use to start learning the ins and outs of Powershell.

7 responses to “Powershell – Part 1

  1. Matt Williamson November 13, 2009 at 3:45 pm

    Nice post. It’s good to know that unix and windows commands both work, but neither are the native cmdlet. I’ll have to start familiarizing myself with what these aliases are actually calling.

    PS – I think ‘get-children’ is ‘get-childitems’.

  2. Pingback: Powershell – Part 2: Opening files, writing to the screen, the pipeline, and dot values « Tome's Land of IT

  3. Pingback: Happy Birthday Powertoe! – Tome’s Land of IT « Tome's Land of IT

  4. LarryT March 24, 2011 at 9:51 pm

    No plurals on the verb-noun syntax.

  5. Jim May 15, 2012 at 1:56 pm

    what is the difference between help and get-help, really? get-help, by itself, returns a usage, whereas help, by itself, returns a list of aliases. get-alias says that help isn’t an alias, so what is it, separate function?

    • Tome May 21, 2012 at 12:35 pm

      That’s exactly it. You can see what the help function does by looking at the following:
      (Get-Command help -CommandType function).definition

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 )

Google+ photo

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

Connecting to %s


Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: