PowerShell 2.0

Hidden amongst all the hype of the Windows 7 release two weeks ago is the fact that in Windows 7 and Server 2008 R2 we now have PowerShell installed by default, and version 2.0 at that. From an administration point of view this is going to make my life a heck of a lot easier in time.

For a good view of what’s new in 2 check out Joel “jaykul” Bennett’s excellent slide deck here

To add to the mammoth PowerShell support included in Windows 7, the Windows 7 Resource Kit also includes a PowerShell Pack which adds 10 modules to help supercharge your Windows PowerShell scripting:

WPK - Create rich user interfaces quick and easily from Windows PowerShell. Think HTA, but easy. Over 600 scripts to help you build quick user interfaces
TaskScheduler - List scheduled tasks, create or delete tasks
FileSystem - Monitor files and folders, check for duplicate files, and check disk space
IsePack – Supercharge your scripting in the Integrated Scripting Environment with over 35 shortcuts
DotNet – Explore loaded types, find commands that can work with a type, and explore how you can use PowerShell, DotNet and COM together
PSImageTools - Convert, rotate, scale, and crop images and get image metadata
PSRSS – Harness the FeedStore from PowerShell
PSSystemTools – Get Operating System or Hardware Information
PSUserTools – Get the users on a system, check for elevation, and start-processaadministrator
PSCodeGen -Generates PowerShell scripts, C# code, and P/Invoke

This is all well and good, but what about the other Microsoft Operating Systems? Well, now Microsoft have released the Windows Management Framework, which includes PowerShell 2.0, WinRM 2.0 and BITS 4.0 providing the same rich experience of PowerShell 2.0 for Vista, Server 2003 & 2008 and Windows XP.

Looks to me like Microsoft just super-sized my PowerShell options :-)

Tech Talk: PowerShell Team Blog – Links

I’m not a fan of just linking to other conversations without adding any value, but in this case the links are worth it.

If you’re interested in PowerShell then you have probably already seen the news over at the Microsoft PowerShell Team Blog, but just in case I’ve linked to the three recent posts that I think are pretty much just awesome. Go take a look, you can bet I will be ;-)

Jonathan and Hal (from the PowerScripting Podcast) will be hosting Jeffrey Snover for a Virtual PowerShell V2 Launch Party on Thursday, which is of course GA* day for Windows 7!!

Lee Holmes from the PowerShell Team has also announced that one of their internal tools has been released as a Codeplex Project.

The Cmdlet Designer makes it much easier for teams to concentrate on the design, naming, and consistency of their cmdlets, while also guaranteeing name registration and collision avoidance across Microsoft.

To sweeten the deal, it offers:

* Integrated help authoring
* Efficient bulk operations (parameter and cmdlet cloning)
* Generation of cmdlet code
* Full scripting support
* Automatic code-spec comparison and testing
* Role-based security, history logging, and more.

But wait, there’s more! It’s now available under MS-PL from http://www.codeplex.com/CmdletDesigner

And last, but in no means least, with the recent announcement of the Windows 7 Resource Kit book comes the availablity of the Windows 7 Resource Kit PowerShell Pack. There’s a detailed breakdown of the features in the PowerShell Team’s blog post, but in a brief look it contains: 10 modules with 600+ scripts. Great work James!

* General Availablity.

Get-PSUGUK and PoSh CTP V2

Last night was pretty miserable weather for the January meeting of the User Group. The main focus of which was the presentation by Jeffrey Snover. I have to say despite the fact it went for over an hour, it didn’t actually feel like it. It had a lot of good content, and I found that afterwards I was left thinking, yet again, that PowerShell is really going to change the face of the Windows administration space,

The general consensus around the community is that Jeffrey is a remarkably down to earth guy, pleasant, and basically just a genuine nice guy. I almost hate to admit it, but just from that short time on hearing his presentation last night that I have to agree. Considering PowerShell’s success both within Microsoft and in the Community/Vendor’s it’s surprising that this is the case. A pleasant surprise all the same.

Anyway, enough of the JS fanboi talk ;), what about PowerShell V2?

I’m hoping to have a closer look at Jeffrey’s slide deck to expand on this in more detail at some point, but I’ll touch on a few of the area’s that I saw last night and appealed to me.

Script Cmdlets
In V1 if you want to create a cmdlet, you need to write them in C# of VB(.Net?). As I’m not a developer/Programmer I never really looked at this idea in any detail. However, the demo Jeffrey gave on this last night reveals that with very little effort you can develop cmdlets written in PowerShell that provide some very nice added value to your scripts.

With V2 I can see that my library of common functions which i dot source in specific scripts, will probably be rewritten as script cmdlets and dot sourced. I’ll try and show some specific examples at a later date.

Restricted RunSpaces
Now, I’m not convinced I have the right idea here, so bear with me. In V2 there is the ability to create a name space with restricted (read: subset of the PowerShell language available) access to PoSH. Now the Administrator in me immediately thinks delegation of administration. Kind of a custom-MMC idea that would allow me to get 1st or 2nd line support run PowerShell scripts, but only the ones i delegate.

I suspect that this functionality is much more fundemental than this though and perhaps, this is more of hearing what I wanted to hear in this case? ;)

PowerShell Editor
There is a lot of 3rd party work going on in this space, and I believe MS are being careful on what they offer here. From the demo I saw last night though I would happily add the MS editor to my list of tools. It’s been made clear that this will only have basic functionality, and will never compete with offering’s being promoted by partners, but it has a couple of nice features that I personally found attractive:
- multiple runspaces available interactively
- type your code in the top half of the editor and have the execution results displayed in the lower half.
- functionality to highlight part of a script and by pressing F5 just run the highlighted element – whether thats part of a line, a few lines or as much of the script as you want.
- colour highlighting (I don’t know if brace matching is supported or likely to be)
- Intellisense will be added later on.

Where is PowerShell going?
What I found most interesting here is that Jeffrey revealed where the PoSH team want to take PowerShell. In particular there will be a lot of focus on how and where the end user will want to run their scripts. Whereas normally, this would lie within the remit of the host OS, they want to take ownership and provide the mechanisms for this to work in a more integrated way.

Anyone who has administered Windows for a period of time, is aware that the GUI is fine for administering one server, but if you want to make a change to all the servers across your estate? Now, these aren’t new challenges we are suddenly being faced with. I’ve been tackling these for nearly ten years. What I find interesting is that it feels like this is the first time Microsoft are really acknowledging the challenges we face, and are working towards making this a whole lot easier. I don’t think this is something that we are going to see overnight, but it feels like a great start!

The one thing I disagree with Jeffrey on, is his thought that the CTP isn’t for everyone. Personally, I believe that anyone who is running PowerShell (not in live here!) should switch over to the CTP. Why? Well, because V2 replaces V1, and as such all V1 functionality shouldn’t have changed. It seems to me the best way to identify any problems under V1 is to get the widest test base looking at it as possible IMHO.

What are your thought’s on V2 and the MS roadmap?