Powershell has evolved over the years, with some old functionality not working in later versions.
Which version of Powershell you are running depends on the installed Windows version.
The general recommendation is to update your environment to the latest version of Powershell, so all scripts are created for the same version. Talking from experience, failure to do so will cause a lot of issues.
In this blog post, I cover how to run the Powershell window using another version.
Powershell versions for each Windows OS
Here is a table of the different Powershell versions that come shipped with each version of Windows:
|Powershell 1.0||November 2006||Windows Server 2008|
|Powershell 2.0||October 2009||Windows Server 2008 R2 (SP1), Windows 7 (SP1)|
|Powershell 3.0||September 2012||Windows Server 2012, Windows 8|
|Powershell 4.0||October 2013||Windows Server 2012 R2, Windows 8.1|
|Powershell 5.0||February 2016||Windows 10|
|Powershell 5.1||January 2017||Windows Server 2016, Windows 10 Anniversary Update|
|Powershell Core 6.0||January 2018||Windows 10, macOS, Linux, Windows Server 2019|
|Powershell Core 6.1||September 2018||Windows 10, macOS, Linux, Windows Server 2019|
|Powershell Core 6.2||March 2019||Windows 10, macOS, Linux, Windows Server 2019|
How to check the version of Powershell
To check the Powershell version, open a Powershell command prompt, and enter:
Above, you can see that the command returns the version of Powershell.
How to change to another version of Powershell
To change the version to v2, enter this command on a machine:
powershell -version 2.0
Update environment to latest Powershell version
Unless you have a good reason not to, I highly recommend upgrading all your machines in your environment to the latest Powershell version.
One way of doing this is through MEMCM (SCCM). Just create an application with the latest Windows Management Framework (WMF), and deploy it to your clients.
Changing the version of Powershell will be required in some cases, but in most cases you should upgrade all clients to the latest version of Powershell.
I hope that you have found the blog post helpful. Let me know if I’ve missed anything!