Poodles Through Burning Hoops: Plan for PowerShell 5 on Win 7 and 2008 R2

Poodles Through Burning Hoops: Plan for PowerShell 5 on Win 7 and 2008 R2

2017-01-30 Update - the steps in this article are no longer necessary

WMF 5.1 now installs directly on top of WMF 3, however it can lose your PSModulePath customizations in the process. I have attempted to address this in the Chocolatey package I help maintain for the PowerShell package on Chocolatey.org. If you don’t use Chocolatey (I feel sorry for you ;) ), you can just steal my PowerShell code that does this piece of the puzzle from the here: https://github.com/IntelliTect/Chocolatey.Packages/blob/master/PowerShell/v5.1/tools/ChocolateyInstall.ps1#L109-L178

If you do use Chocolatey, you can simply do this:

choco install dotnet4.5.1 -confirm -force
choco install powershell -confirm -force

Original Article:


The PowerShell Production Preview was released on August 31st and the version number is 5.0.10514.6 ! (Windows 10 PowerShell version is 5.0.10240.16384)

Back in May I published the article “Getting PowerShell 5 Running on Windows 7 and Server 2008 R2” It turns out there are a lot of poodles to get through the burning hoops to get a Windows 7 SP1 or Server 2008 R2 machine updated from PowerShell 2 or 3 to PowerShell 5.

“…from PowerShell 2.0…” !?! - like who in their right mind is on PowerShell 2.0 ?

The answer is that many cloud host templates are on the lowest versions of all system runtimes - including .NET and PowerShell. This is common because cloud hosting companies don’t want to load up a template with runtimes that might be incompatible with the solution you want to build on top of the template. So a common first task in such VMs is to bring them up to the latest version of our primary automation tool, PowerShell.

And if you are the one who maintains system images for either of these OSes, it is fundamental to your job to build the process that layers you up to PowerShell 5 - whatever that might entail.

In the previous article “Getting PowerShell 5 Running on Windows 7 and Server 2008 R2” I mentioned that the PowerShell team at Microsoft was hoping to eliminate the requirement to have WMF / PowerShell 4 installed on Windows 7 / Server 2008 R2 as a prerequisite to install WMF / PowerShell 5. Because I help maintain a Chocolatey package and quick config script to update PowerShell to 5, I touched bases with the PowerShell team and they have indicated that this requirement will not be lifted.

So Here’s The “Plan”

The overview is that if you want to have PowerShell 5 on Win7 or Server 2008, you should get your machines up to WMF / PowerShell 4 while you wait for the production release of 5.

If you are on PowerShell 2 or 3, you will have to:

  1. Windows 7 / Server 2008 R2 ONLY: SP1 must be installed (evaluation media or VHDs may not have SP1)

  2. Be sure you have .NET 4.5.1 or later to support WMF 4 (on production systems always verify that moving to a new level of .NET will not break anything). .NET 4.5.1 also works fine for PowerShell 5.

  3. OUCH: The WMF 4 installer will complete successfully when .NET 4.5.1 or later is not installed, but when you issue $psversiontable in PowerShell - it will still be version 2.0. The fix is to uninstall WMF 4, install .NET 4.5.1 or later, reinstall WMF 4.

  4. Windows 7 / Server 2008 R2 ONLY: Install WMF 4.

  5. OUCH: According to the release notes WMF 4 is a prerequisite for WMF 5. I confirmed this with the PowerShell team at Microsoft. The bigger ouch is that you can successfully install WMF 5 on top of PowerShell 2 and when you reboot PowerShell shows version 5! So what state does that leave you in? I’m not sure - but I do have some pesty questions into the right people. Install WMF 5 and verify that your PowerShell version is 5.0.10514.6 This is explained in much more detail in the above article which you should read if you need to do this manually with your own automation. For the Production Preview I have updated the both the [a] Chocolatey package for PowerShell 5 and [b] the “QuickConfig” script for use on test machines.

  6. he Chocolatey package will pre-empt if you do not have dotnet 4.5.1 - you must resolve this dependency yourself so that you can assess whether 4.5.1 breaks anything in your build.

  7. The Chocolatey package does detect if WMF 4 is missing on Win7 or 2008 R2 and install it first. Re-running the package again with the -force parameter will get you all the way up to version 5.

If you have a previous preview release of PowerShell 5, it will have to be removed before installing the latest one.

For the chocolatey package use the following command (after installing Chocolatey):

choco install powershell -Confirm -Force

If you don’t know what chocolatey is, or want to be spared the details to load WMF on a test machine, follow this quick config procedure:

You can see the complete source of the script before running here: https://raw.githubusercontent.com/CSI-Windowscom/Bootstraps/master/QuickConfigPowerShell5.ps1

Here are the quick config steps:

  1. Open a PowerShell console as Administrator.

  2. Paste this command line into the console (one line): iex ((new-object net.webclient).DownloadString(‘https://raw.githubusercontent.com/CSI-Windowscom/Bootstraps/master/QuickConfigPowerShell5.ps1'))

  3. Each time the system reboots, re-run the above command line. In most cases two reboots will get you to PowerShell 5 on Windows 7 SP1 or Server 2008 R2.

  4. On the last time you re-run it, you will be prompted whether to download all the latest versions of the DSC Resources on PowerShellGallery.com - this is optional and generally used for a lab machine for getting started with DSC.