Getting PowerShell 5 Running on Windows 7 and Server 2008 R2

PowerShellMagazine - (wallpaper) - KEEP CALM.cdr

The two biggest features in PowerShell 5.0 are Windows PowerShell OneGet and a new module for managing layer 2 network switches. Other features include updates for Desired State Configuration (DSC), the PowerShell console, and the Integrated Scripting Environment (ISE).

OneGet is the PowerShell team’s answer to the complexity of application installation. By using the Chocolately repository, applications can be installed, updated, or removed with command line precision.OneGet can potentially let you automate complex application installations, simplify network shares, and make reinstallation much easier. Imagine creating a OneGet script that installs all of your favorite applications automatically.

Windows Server 2012 R2 introduced native management of layer 2 network switches. When you have Windows Server certified equipment, you can use SCVMM 2012 R2 to manage the hardware. There are times when you might need to manage equipment with a PowerShell script. WMF 5.0 introduces that ability.

The new module, Network Switch, contains 19 cmdlets that allow you to do the following in a CIM session:

  • Investigate the switch and available features with the Get-NetworkSwitchFeature cmdlet.
  • Configure specific switch features or enable/disable switch features.
  • Manage VLANs with the NetworkSwitchVLAN cmdlet set (Get, New, Disable, Enable, Remove, Set).
  • Save or restore switch configurations.

So what is needed for getting PowerShell 5.0 on a Windows 7 or Server 2008 R2?

  1. You must have SP1.  If you are using source media that does not have it slip-streamed then you’ll need to apply it before getting started.  Most cloud based VMs should have SP1 on Server 2008 already.
  2. You must have .NET 3.5.1 or later to install PowerShell 4.  However, the PowerShell 4 installer does not block you if you don’t have it.  It successfully installs and then when you reboot you are still on your previous version (2 or 3).  You have to uninstall the PowerShell 4 Windows Update and then install .NET 4.5.1 and then reinstall PowerShell 4.  If you use the quick config below – this is detected for you and you are instructed to issue a chocolatey command to easily pull .NET 4.5.1 onto your system.
  3. You must first install PowerShell / Windows Management Framework WMF 4 before you can install PowerShell / WMF 5.  This is an interim dependency that the PowerShell team is planning to eliminate for the production release.  However if you try to install PowerShell 5 without 4 present, you just get a standard Windows Update WUSA error “This Update is not applicable to your system” (Error: 2149842967 or 0x80240017).  PowerShell 5 installs via one of the following windows updates:KB3055381, KB3055377 or KB2908075. The below quick config also detects this situation and installs PowerShell 4 and instructs you to reboot and re-run the quick config.
  4. Finally you can install PowerShell 5.