How to install PowerShell 5.1 on Windows Server 2012 R2

Update Windows PowerShell to version 4.0 or 5.x.

Windows 2012 R2 includes PowerShell 4.0 by default. It may be updated with the installation of Windows Management Framework (WMF) 5.0 or 5.1.

Windows 2012 requires the installation of Windows Management Framework (WMF) 4.0, 5.0, or 5.1.

Updating to a later PowerShell version may have compatibility issues with some applications. The following links should be reviewed and updates tested before applying to a production environment.

WMF 4.0:
Review the System Requirements under the download link - https://www.microsoft.com/en-us/download/details.aspx?id=40855

WMF 5.0:
https://docs.microsoft.com/en-us/powershell/wmf/5.0/productincompat

WMF 5.1:
https://docs.microsoft.com/en-us/powershell/wmf/5.1/productincompat

How to install PowerShell 5.1 on Windows Server 2012 R2

Mar 14, 2016

How to install PowerShell 5.1 on Windows Server 2012 R2

Introduction

PowerShell continues to improve, many features are being added and now we have PowerShell 5 that is available for installation on Windows Server 2012 and Windows 8.1. The installation is simple and only requires a reboot. Windows Management Framework 5.0 (WMF 5) includes updates to Windows PowerShell, Windows PowerShell Desired State Configuration (DSC), Windows Remote Management (WinRM), Windows Management Instrumentation (WMI).

Windows Management Framework (WMF) 5.0 RTM brings functionality that has been updated from WMF 4.0. WMF 5.0 RTM is available for installation only on Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2, Windows 8.1, and Windows 7 SP1 and contains updated versions or introduction of the following features:

  • Windows PowerShell
  • Just Enough Administration (JEA)
  • Windows PowerShell Desired State Configuration (DSC)
  • Windows PowerShell Integrated Scripting Environment (ISE)
  • Windows PowerShell Web Services (Management OData IIS Extension)
  • Windows Remote Management (WinRM)
  • Windows Management Instrumentation (WMI)

WMF 5.0 RTM replaces the WMF 5.0 Production Preview. You can install WMF 5.0 RTM without uninstalling WMF 5.0 Production Preview, but you must uninstall all other older releases of WMF 5.0 previews before installing the WMF 5.0 RTM.

Process

Download WMF 5 from https://www.microsoft.com/en-us/download/details.aspx?id=50395. There are several packages to choose from for installation.

How to install PowerShell 5.1 on Windows Server 2012 R2

Since we are installing on Windows Server 2012 R2 in this example select Win8.1AndW2K12R2-KB3134758-x64.msu or W2K12-KB3134759-x64.msu. For my choice the winner was Win8.1AndW2K12R2-KB3134758-x64.msu. Once downloaded double-click to start the installation and reboot when prompted.

Once the system is back up check the version. Open PowerShell and type $host.version.

How to install PowerShell 5.1 on Windows Server 2012 R2

Conclusion

There you have it! Windows PowerShell 5 is now installed and available for you to explore the updated and new features like Windows PowerShell Desired State Configuration (DSC), which we will cover in future posts!

Trackbacks/Pingbacks

    How to install PowerShell 5.1 on Windows Server 2012 R2

    The latest version of PowerShell, version 5.1 was released for WS2012R2, WS2012, W8.1, W2008R2, W7 SP1 on 1/19/2017. The WMF 5.1 version of PowerShell is already running in WS2016 and W10 machines.

    Release Notes
    Install and Configure

    WS2016 and W10:

    How to install PowerShell 5.1 on Windows Server 2012 R2

    1. Installation for WS2008R2 (and W7 SP1)

    Overview:
    Install .NET Framework 4.5.1 (if required) > Restart > Verify Installation
    Install WMF 5.1 > Restart > Verify Installation

    1. Have all current Windows updates installed on 2008R2 SP1 machine

    2. Download the WMF5.1 Package and Prerequisites for W2008R2, choosing 32 or 64 bit options.

    • x64:Win7AndW2K8R2-KB3191566-x64.ZIP
      x86:Win7-KB3191566-x86.ZIP
    • NET Framework 4.5 exe setup file
    • The zip file contains an MSU file and the PowerShell script file Install-WMF5.1.ps1

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • Unblock the Install-WMF5.1.ps1:

    How to install PowerShell 5.1 on Windows Server 2012 R2
    How to install PowerShell 5.1 on Windows Server 2012 R2

    3. Check for current version of .NET Framework installed in Control Panel > Programs and Features:

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • NOTE: .NET Framework 4.5.X version is the minimum requirement. If .NET 4.6 is installed, it is not necessary to uninstall. .NET 4.5 will not install if .NET 4.6 is already installed.

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • Install the .NET Framework 4.5 exe file and reboot the machine after installation complete.
    • Verify that the updated .NET Framework 4.5 installed via Control Panel > Programs and Features

    How to install PowerShell 5.1 on Windows Server 2012 R2
    How to install PowerShell 5.1 on Windows Server 2012 R2

    4. Open PowerShell as an Administrator and check that the Execution Policy will allow scripts to be run.

    • Get-ExecutionPolicy
    • If it returns Restricted, then run:
      • Set-ExecutionPolicy RemoteSigned
    • Check to find the current version of PowerShell installed:
      • $PSVersionTable

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • Navigate to the folder of unzipped files (in this case it is the E:\Downloads folder):
      • Set-Location E:\Downloads
    • Run the script:
      • .\InstallWmf5.1

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • If the prerequisites are found, then the WMF5.1 upgrade installation will begin.

    How to install PowerShell 5.1 on Windows Server 2012 R2

    How to install PowerShell 5.1 on Windows Server 2012 R2
    How to install PowerShell 5.1 on Windows Server 2012 R2

    • Restart the machine at the end of the installation > Verify installation via Control Panel > Windows Updates > Update History

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • Verify the successful WMF5.1 installation in an elevated PowerShell session:

    How to install PowerShell 5.1 on Windows Server 2012 R2

    2. Installation on WS2012R2 (and W8.1)

    1. Have all current Windows updates installed on the WS2012R2 machine.

    2. Download the WMF5.1 Package 

    • Win8.1AndW2K12R2-KB3191564-x64.msu

    3. Open PowerShell (PS) as an Administrator and check the current version of PS installed:

    • $PSVersionTable

    How to install PowerShell 5.1 on Windows Server 2012 R2

    4. Double click on the MSU file downloaded and the installation process will begin:

    How to install PowerShell 5.1 on Windows Server 2012 R2

    How to install PowerShell 5.1 on Windows Server 2012 R2
    How to install PowerShell 5.1 on Windows Server 2012 R2

    4. Restart the machine > verify successful installation of WMF 5.1 via Control Panel > Programs and Features > Installed Updates:

    How to install PowerShell 5.1 on Windows Server 2012 R2

    • Verify the successful WMF5.1 installation in an elevated PowerShell session:

    How to install PowerShell 5.1 on Windows Server 2012 R2

    Is PowerShell 5.0 included with Windows Server 2012 R2?

    This program is included in Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows Management Framework 4.0, and Windows Management Framework 3.0.

    Is PowerShell 5.1 backwards compatible?

    Windows PowerShell 5.1 is backward-compatible. Cmdlets, providers, modules, snap-ins, scripts, functions, and profiles that were designed for Windows PowerShell 4.0, Windows PowerShell 3.0, and Windows PowerShell 2.0 generally work in Windows PowerShell 5.1 without changes.

    How do I install PowerShell version?

    Install PowerShell using Winget (recommended).
    Installing the MSI package..
    Installing the ZIP package..
    Install as a .NET Global tool..
    Installing from the Microsoft Store..
    Installing a preview version..
    Upgrading an existing installation..
    Deploying on Windows 10 IoT Enterprise..

    How do I update my PowerShell version?

    If you need to update your existing version of PowerShell, in Windows, use the following table to locate the installer for the version of PowerShell you want to update to. On the initial release of Windows 10, with automatic updates enabled, PowerShell gets updated from version 5.0 to 5.1.