PS for .NET devs part 1: Getting started with PowerShell
The resource list
By now PowerShell has gained so much traction at this moment that I could probably fill several dozen pages with links, pointers to the excellent resources available on-line or in print. However I will refrain myself to a couple starting points.
- PowerShell Community Toolbar This is a browser plug-in that aggregates a big set of resources, from download links to the various PowerShell releases to a huge list of blogs filled with PowerShell content, to the localized PowerShell on-line help. Even if you are not very fond of browser toolbars I suggest you install it, take some time to follow the various links save them and uninstall the toolbar.
- ScriptCenter PowerShell homepage this contains loads of resources to get you started and should be considered the canonical starting point for finding PowerShell related resources.
- Windows PowerShell Survival guide A large list of resources to get you started, compiled by the community.
- PowerScripting podcast If you have some time during you commute or any other activity that allows you to listen to some audio I highly recommend this show. The show notes are of a great quality, and contain lots of links to learning resources. The first shows take you step by step through the process of learning PowerShell.
- Effective Windows PowerShell A great set of tips, explanations to be as the title suggests effective with PowerShell.
- Master-PowerShell A very comprehensive free e-book starting with the basics and ending with a guide to remoting.
- Windows PowerShell in Action, Second Edition This is in my opinion the PowerShell book available today that is the best suited for developers. It goes into all the details of the language and is very well written. Be sure to get the (recently) released second edition, since it is filled with loads of extra content covering the PowerShell version 2 features.
Just use PowerShell instead of cmd
When learning something new it is always nice to be able to start with
something familiar. The beauty of PowerShell is that all your
previous knowledge about your favorite command-line tools are not
lost. PowerShell is a shell which means you can use it to start
any of tool you used to start in cmd. Moreover the PowerShell
team has incorporated a large number of aliases that should be
familiar to you whether you are coming from a linux or cmd background
the commands you know like
rm all work as you
would expect. These aliases are also very handy for those who don't
like to type long commands at the prompt. To get an idea of what
aliases are available try the following:
The 3 amigo's of discovery
Get-Help does exactly what you would expect especially when you know
help. You can get the help on help by typing
at the prompt. This shows you how you can use
that PowerShell also comes with topical help pages that start
about_ to get an overview of the available topics type:
at the PowerShell prompt.
Get-Command provides a way to search for a Cmdlet you would
like to use. Looking at the output of
help Get-Command or shorter
Get-Command -? you will see that one of the parameter sets contain
-Verb parameters. The naming convention used for
<Verb>-<Noun> this makes remembering and searching the
Cmdlets a lot easier. Say for instance I would like to know all
Cmdlets that remove stuff then
will list them nicely. If I would like to know what Cmdlets are available for working with computer objects, I would type:
Get-Member list all member that is public methods and properties
of the object passed to it. This ideal for finding what information
can be extracted from an object, what you can do with a specific
object respectively. To for instance lookup what properties you could
use on a file to sort in a directory listing you could type
Or if you don't want to wait on a slowly loading MSDN page to lookup
what methods are available to you on a
TimeSpan object you
could use something like:
Or if you can't remember the way
SubString works type:
gm is the (shorter) alias for
I hope this provides enough pointers to guide you through your first steps to PowerShell mastery. Check back soon for part 2 of this series when we dive in to the PowerShell language as viewed through the eyes of a C# developer.
- PS for .NET devs part 0: PowerShell what is it and why should I care?
- Technet: Scripting with Windows PowerShell
- PowerShell Community Toolbar
- Windows PowerShell in Action
- PowerScripting Podcast
- Windows PowerShell Survival Guide
- Effective Windows PowerShell
- About Aliases
- Cmdlet Overview
- Get-Help online help
- Get-Command online help
- PS for .NET devs category
- Get-Member online help
- msdn: TimeSpan