I’m working on a project at work where we use PowerShell scripts to deploy a working system from a Subversion repository to a target server. It uses PS 1.0 which doesn’t have remote scripting capabilities (other than the ability to do some WMI queries remotely) so the original team architect wrote a remote runspace Windows service which packages the scripting payload and user credentials for execution on a remote machine. Pretty sweet stuff.
PowerShell 2.0 is currently in CTP and supports remote scripting as well as running background tasks either locally or remotely. I can’t wait until we can use this version, hopefully later this year. To try it out I decided to install the CTP bits on my laptop – unfortunately I can’t install it on my main dev box as it needs to have PS 1.0 and they can’t run side-by-side.
Now to get to the point of this article, installation. My first attempt at installing 2.0 resulted in a message that it has a prerequisite of WS-Management v1.1. Wikipedia reports that WS-Management is “a specification of a SOAP-based protocol for the management of servers, devices, applications and more.” It’s based on a Distributed Management Task Force standard developed by a consortium of companies that includes Microsoft, Dell, AMD, Intel, Sun and others. Microsoft’s implementation is also known as Windows Remote Management (WinRM). It’s included with Vista and Server 2008 but you need to install it if you’re running anything else.
So I installed it and then re-started the PS 2 install. This time it wants me to uninstall PS 1. Ok… but what’s this? Add/Remove Programs doesn’t show PowerShell in the list? After some Googling I find out that even though PowerShell is a separate installation (for legacy os (i.e., XP, 2003 Server) users like myself), it is actually considered part of Windows. I found this explanation in the PowerShell forum:
“Have you installed a service pack since you installed powershell v1.0? –e.g. windows 2003 sp2? since powershell is technically delivered as a hotfix, a service pack placed on top if will remove it from the add/remove program files list – even with updates shown. The “correct” way to uninstall it is to uninstall the service pack, uninstall posh,
reinstall service pack. Horrible, yes; but any other way of removingit is bound to be unsupported. That said, someone else might know some tricks on this one.”
Whoa!?! Uninstall the whole service pack!? No thanks. Fortunately, more digging turned up instructions to do the following:
1. check the “Show updates” checkbox at the top of the Add/Remove Programs dialog.
2. Look for one of a few updates (e.g., KB926139), or, in my case, just find PowerShell 1.0 listed in the Add/Remove list alongside the many hotfixes.
3. Click the Remove button: sounds easy but the uninstall dialog reported that doing so might break one or more of a whole long list of programs, some of which were actually the hotfixes themselves! I first cancelled out of that but after finding no other clues, decided to take the plunge and just let the uninstaller do its thing.
Everything went fine and PS 1 was unstalled. I then was able to successfully install PS 2. Whew!