Thomas LeeThomas Lee is a UK IT Pro, with over 40 MVP Logoyear’s experience in the IT field. He’s presently a PowerShell MCP and is very busy doing writing, consulting and training around some of the key Microsoft technologies including PowerShell, Lync and Windows Server/client. In his spare time, he lives in a small cottage with wife, daughter, a nice wine cellar and a large collection of Grateful Dead live recordings.

Introduction

Windows 8, Microsoft’s latest incarnation of a client operating system, was recently released to manufacturing and subsequently released to developers and IT professionals via both TechNet and MSDN. General availability of Windows 8 is scheduled for October 26th. One of the cooler features of Windows 8 is the inclusion of Windows PowerShell V3. In this article, I’ll look at some of the PowerShell features that you can leverage in Windows 8.

Background to PowerShell

PowerShell has been under construction for the better part of 10 years – the Monad Manifesto (PDF). It’s a tad out of date and some things have changed – but it does an outstanding job at setting out the issues, as existed then, and a solution. The solution, more or less, is now being delivered in PowerShell v3. For developers, one of the promises of the Monad Manifesto was the ability to write GUIs that sat above leveraging PowerShell.

At that time, the ‘state of the art’ in terms of administrative scripting was a combination of using DOS batch language and VBscript. VBscript, though, was a fairly low level programming language. You really needed to know how to use the COM components – and those were never easy. By way of comparison – PowerShell is a task automation tool, aimed at helping IT Pros do their job in way that can be automated and is aimed at helping developers build more manageable applications.

PowerShell’s first serious user was the Exchange team, who took it on whole heartedly. They did a great job, given what was possible in PowerShell v1. Although, there were a lot of IT professionals (and developers too) who took one look at the syntax of the day and ran for the hills. It was ‘programming’ and had very weird syntax. It looked hard to use. But like any powerful tool, yet there’s a learning curve, but a few days training will get most PowerShell up to speed with the basics. From then on, it’s just a matter of practice.

What’s in the box

PowerShell is now fully integrated into Windows 8 and Windows Server 2012 – and that integration is an important feature! It’s even integrated into the Server Core installation option, although for legacy reasons, the shell that starts up in Server core is cmd.exe – but a quick registry hack can fix that (see http://tfl09.blogspot.co.uk/2012/07/making-powershell-default-shell-in.html for more details on how to do that).

Today you can download both Windows 8, Windows Server 2012 and the components needed that implement PowerShell on Windows 7 and Server 2008/2008 R2.PowerShell v3. You can also download all the components needed that implement PowerShell on Windows 7 and Server 2008/2008 R2.

One of the nicer features of PowerShell 3 that developers will like is the updated Integrated Scripting Environment (ISE). The ISE is a combination of PowerShell editor and console with a wealth of both add-ons and the ability to create more.

Introduced with PowerShell V2 (that shipped with Windows 7). One of the really great features of the ISE is intellisense – you type something and PowerShell can try to finish it off. The intellisense in V3 is pretty awesome, not only does it autocomplete cmdlet and parameter names, but can often provide the value for parameters where the parameter value is an enum. This makes using new (new to you!) cmdlets easier. For developers used to Visual Studio, this is old hat – but it’s still welcome for PowerShell developers as PowerShell is not supported in Visual Studio.

clip_image002

For many IT Professionals, the ISE is sufficiently good that 3rd party development tools are not needed!

New Modules in Windows 8

PowerShell is more than just a few .exes and related config files. What matters is the modules that ship in the product (or are available readily for download). Modules provide the cmdlets and related features that enable you to interact and manage aspects of Windows 8. In Windows 8, I can type Get-Module –ListAvailable to see the list of modules included by default. On my machine there are 52 system modules, as shown here!

clip_image004

That’s a lot of functionality – and most IT Professionals and developers will never use all of it. And if you did this on Windows Server 2012 (with all roles added) there are even more!

One aspect of many of these cmdlets is that they were created using a combination of XML and the underlying WMI infrastructure. This means that if you develop a WMI provider for your application, you can very easily turn the classes in your providers into useful cmdlets by just writing a bit of XML. This is a major productivity feature for developers that are developing enterprise scale applications.

Learning more about PowerShell V3 and Windows 8

One of the sound-bite comments about PowerShell I like is: “Learn PowerShell, or learn how smile and say ‘would you like fries with that burger’” It might sound a tad harsh, but PowerShell really IS the future of both Windows Administration and the development of manageable enterprise applications.

Most IT professionals and developers with batch and VBScript skills will still have a job, but as I say, PowerShell is the future – I would expect to see more, more and more in future versions of both Windows and of all the Microsoft server applications. The industry is also adoption PowerShell – Vmware, Symantec, Cisco and EMC to name a few, have released PowerShell cmdlet to help manage their application suites.As for developers, PowerShell presents a new, and more efficient, way of both developing the admin interfaces to their applications and delivering core functionality – look at Exchange or Lync as examples of this.

Like most IT products, there are several ways you can learn PowerShell. You can teach yourself – as a PowerShell pioneer that’s the way I learned most of it. You can hang out in forums, like those on PowerShell.com, asking and answering questions. You can read the thousands of blog posts (like you see on Http://tfl09.blogspot.com), or review scripts (e.g. those posted on http://pshscripts.blogspot.com). And you can hone your skills on your own PCs. But this can be slow, and for many the learning curve is steep.

A good alternative is a good PowerShell course. The Microsoft official course, 10135, is a good training course (I have to admit I was the Tech Editor on the course) but it’s a little slow paced, and only covers the basics.

For those UK IT Professionals (or anyone sufficiently motivated and the ability to visit London!) can attend my PowerShell PowerCamp. I run a 2-day very fast paced intro to PowerShell over a weekend and a price IT Professionals can often afford from their own pocket. For more details on the next PowerCamp, which will be held in October, see http://tfl09.blogspot.co.uk/2012/08/announcing-powershell-v3.html. We’ll be looking at PowerShell 3 and will cover the aspects noted in this blog article.

Summary

Windows 8 is here, and Sever 2012 is just a few days away. With PowerShell, you can take it to the next lever – so my key message is: Get PowerShell, learn PowerShell and embrace it. It’s the future of administration and application development in a Windows environment.