Thursday, January 15, 2009

Upgrade to PowerShell V2

After I had cursed the command line completion of PowerShell for being so utterly powerless, PowerShell developer Lee Holmes commented:

Thanks for the feedback. Much of this behavior has been improved in the latest CTPs of PowerShell V2.

And he pointed me to CTP3 of PowerShell V2. Well, I thought, if these things really have been improved, then I'm most certainly going to try it out.

I downloaded the CTP3 ("Community Technology Preview 3" – this is Microsoft saying "Alpha"), and was going to install it and see, what has changed. But you know, it couldn't be that easy... even with Microsoft developer pointing you in the right direction... it's still Windows...

Installing and Uninstalling

The download page contained a small paragraph, hidden between the others, instructing me to uninstall the previous version of PowerShell first - I chose to ignore it, thinking it was just another measure to help save Microsoft his ass when something goes wrong.

I started up the installer, clicked next and next... everything was going fine. Until I was confronted with this:

Cannot install this version of the product. You must first remove any earlier versions of Windows PowerShell before you can install this version. Refer to install notes for uninstalling previous versions.

Alright, I thought, if that's really what you want, then I uninstall it.

  • I opened up Add/Remove Programs to uninstall it and... it wasn't there. I scanned the list for quite some time, wondering if it's named "PowerShell", "Windows PowerShell", "Microsoft Windows PowerShell" or even something else. Nope... not in that list.
  • I went to the Start menu entry of PowerShell... no uninstall option there.
  • I went to c:\Program Files\PowerSh... nothing like that over there. Where is the damn thing!?
  • Finally found it from c:\Windows\System32\WindowsPowerShell\v1.0. I removed these files, restarted installer, and was greeted with the already familiar error message.
  • I tried several more things, which didn't helped either.
  • I even searched around the registry, but didn't felt comfortable enough to modify it.

Finally I found uninstall instructions, hidden away inside one Windows PowerShell Blog post.

It appeared, that PowerShell was actually installed not as a separate program, but as a Windows update. And in the Add/Remove Programs dialog I had to check the "show updates" option to be able to see and uninstall it.

After that the installation of PowerShell V2 worked out just fine.

A Miracle Has Happened

It appears that the two things I complained about in the Powerless Completion of PowerShell have indeed been fixed.

Completion now also works with executable files in my $PATH and also with aliases. Additionally to complete cmdlet name like Join-Path I can just type jo and press TAB, instead of being only able to complete the part after the dash. Although I would prefer fir to be completed to firefox not firefox.exe, I'm quite satisfied.

On the filename completion side cd foo\bar is no more expanded to cd 'C:\Documents and Settings\Rene\Desktop\foo\bar'. Although it is still expanded a bit, to .\foo\bar, but this is still a big win in brevity.

So yes, a miracle really has happened. First time in this blog a truly happy end.

No comments:

Post a Comment