Reputation: 43
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!
Upvotes: 3
Views: 725
Reputation: 10044
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
Upvotes: 3