Check PowerShell version and install a new version

In this blog post I’ll will show you how determining what version of PowerShell you have installed. The PowerShell version information is contained in the variable $PSVersionTable.

Type $PSVersionTable or $psv in the PowerShell console:

$PSVersionTable

I checked the PowerShell version on a computer that is running Windows 7. By default PowerShell version 2 is installed on Windows 7.

PowerShell version 2 is still a viable solution and your only option if you running Windows Server 2003 or Windows Vista. There are a few reasons not upgrade to a newer version.

There are versions of Exchange, System Center, and various other applications that you may have installed which may not support a newer version of PowerShell or the .NET Framework version. Check your application vendors before proceeding with upgrading to a newer version of PowerShell.

Note: You should always a new version of PowerShell in a test environment before installing it on a production system.

Below a table that shows you which PowerShell version ship with all of the currently supported Microsoft operating system versions:

I download and install PowerShell version 4 on a Windows 7 computer that’s being used in this blog post. PowerShell is distributed as part of the Windows Management Framework which you’ll sometimes see the acronym WMF for.

Download the Windows Management Framework 4.0 and make sure that your system meets the requirements. Windows 7 requires that service pack 1 is installed, so check if it’s installed:

Get-WmiObject -Class Win32_OperatingSystem | Format-Table Caption, ServicePackMajorVersion -AutoSize

The full version of the .NET Framework 4.5 is also a prerequisite. A simple PowerShell one-liner can be used to check to see whether or not it’s installed:

(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -ErrorAction SilentlyContinue).Version -like '4.5*'

As you can see the .NET Framework 4.5 is currently installed. Keep in mind that the full version of the .NET Framework 4.5 is required and the client version is not sufficient. You’ll receive the error “The Update is Not Applicable to Your Computer” if the client version is installed and not the full version when trying to install the Windows Management Framework 4.0.

If it was necessary to install the Windows Management Framework 4.0. A restart is required after the installation. Check the PowerShell version again:

$PSVersionTable

PowerShell version 4 has now successfully installed on the Windows 7 computer.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s