Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change powershell version

Tags:

powershell

I have a Windows 10 machine that is running Powershell version 5. When I type in $psversiontable, I get:

    PS C:\WINDOWS\system32> $psversiontable

 Name                           Value
----                           -----
PSVersion                      5.1.14393.1198
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.1198
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

When I try to change version by typing in powershell -version 4.0, I still get this:

PS C:\WINDOWS\system32> $psversiontable

 Name                           Value
----                           -----
PSVersion                      5.1.14393.1198
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.1198
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Do you know how I can run version 4?

Thanks!

like image 810
nMountain Avatar asked Aug 26 '26 16:08

nMountain


1 Answers

The short answer is you can't. There is only a special mode for version 2.0.

Otherwise PowerShell is extremely backwards compatible. Even further PowerShell 3.0 and 4.0 can't be installed side-by-side. Sapien wrote a great blog post covering additional details on this

In general barring a very few outlier bugs, code written for PowerShell 3.0 or 4.0 will work with 5.0/5.1

like image 111
BenH Avatar answered Aug 29 '26 02:08

BenH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!