Main Page

Getting Started

PowerShell Downloads (from Microsoft)

PowerShell Resources

Svendsen Tech PowerShell Wiki Links

About This Site



Donations are welcome! I have starving kids to feed.

What Is PowerShell?

PowerShell, formerly known as Monad, is both a powerful interactive shell and a programming language / scripting language from Microsoft. PowerShell is a scripting environment which provides one interface to Windows technologies like WMI, COM and .NET. PowerShell version 1 (v1) was released by Microsoft in 2006. PowerShell version 2 (v2) was released in 2009. PowerShell v2 has significantly more features than PowerShell v1. It was a major, and welcome, release.

PowerShell version 3 is included in Windows 8, in both server and workstation editions. Windows PowerShell v3 is available for download for Windows 7 / 2008 R2 here at Microsoft's site. Some people think PowerShell version 3 came with a lot of new "commands" (in PowerShell we have something called "cmdlets" - pronounced "commandlets"), but actually a lot of them are only available with Windows 8 or newer.

PowerShell version 4 (the current stable version as of December 14th, 2013) is included with Windows 8.1 and Windows Server 2012 R2. It was released October 17th, 2013. It can be installed on Windows 7 / 2008 R2 if you make sure to install .NET framework version 4.5.1 first. Windows Management Framework v4 can be downloaded from Microsoft's site here. PowerShell version 4 does not have many (any?) new cmdlets compared to version 3, except for those related to Desired State Configuration (DSC - see below).

The difference between a scripting and a programming language isn't as easy to explain as one might think at first - and they are basically the same. I've heard argued that Turing completeness (basically "it is a programming language that can solve any computing problem") is a more important factor than the fairly disputed distinction between scripting and programming languages.

With each new release of PowerShell, some major new feature introduced has been introduced. Roughly they are as follow:

Example of Interactive Use

Here you can see that you can run the familiar cmd.exe ("DOS") command dir as you're used to. It's really an alias for the cmdlet Get-ChildItem. Linux and UNIX users will be happy to hear that Microsoft was kind enough to add the alias ls as well. You can also use it as a type of calculator, and I demonstrate the polymorphic behaviour of the multiplication operator ("*") where it works on a string.

Last is a more complex example where I use WMI to query the Win32_ComputerSystem class, get the property TotalPhysicalMemory, convert it to gigabytes and format it with two decimals using the ToString() method. PowerShell often needs "help" in the form of parentheses to group expressions (and sometimes for introducing expression context).




PowerShell reminds me of Perl in the sense that it basically is designed after the so-called "DWIM" principle (Do What I Mean), and in fact the PowerShell team modeled early prototypes of the language on Perl.

Perl is available for Windows, and I've used it extensively over the years, because I've never been a fan of VBScript. If there was something I needed VBScript for, I would generally write a Perl wrapper around the required VBScript parts. Read more about Perl on Windows here in the Svendsen Tech wiki - and - here on perl.org.

PowerShell later changed to more closely mimic C#, but some things remained, like the special, magically populated, so-called automatic variable "$_".

PowerShell Availability and Download From Microsoft

PowerShell started shipping in-the-box with Windows 7 and Windows Server 2008 R2 (version 2). It can be installed as an optional Windows Update in earlier versions of Windows. It can also be downloaded. Powershell v2 comes with the Windows Management Framework Core package available for free to download from Microsoft. Check out the download links in the left-side menu.

PowerShell's influence has grown since its arrival in 2006 and it is now used for many tasks. One early, principle shift towards PowerShell from Microsoft was seen with the introduction of Exchange 2007, where PowerShell is heavily used. Exchange 2010 is no different. I hope, and expect, to also see PowerShell in later versions of Windows - on both workstation and server editions.

Recommended PowerShell Book

Today there is a large number of PowerShell users. I assume most PowerShell users use it for systems administration tasks and automating things. Some also develop in/with it. Personally, I'm somewhere in between at the moment, and still learning. This book is useful for most learning purposes. You can use it as a reference if you don't have the time/effort/energy/intellect/whatever to become truly proficient with PowerShell. Or you can read it cover to cover (or some variation thereof) and probably learn more than you need to know.

After having read the first edition some years ago, and being well on my way into the second edition, I can easily recommend the book "Windows PowerShell in Action, Second Edition", by Bruce Payette - one of the core team members in Microsoft's PowerShell team. Make sure you get the second edition (you will get the first edition for free if you get it from Manning). It's available as both an ebook and a paper copy from Manning Publications Co. Currently this is a direct link to the Manning Publications' page for the book: Windows PowerShell in Action, Second Edition. You can also get the book in PDF format only, and it's normally available for download shortly after finishing the payment process. Your name and email address will be at the bottom of every page of the PDF book that's generated; at least they were for me when I bought it. It's also available as a paper copy on Amazon (currently this is a direct link to it) and likely other places, like real world book stores.

The book has a lot of content and is very comprehensive. If you read, understand and remember even half of it, you will have a very high understanding of PowerShell. As the author says in the introduction, it's as much about why as how, so it provides a certain insight (I dare say) rarely found in other publications about PowerShell.