This topic contains 3 replies, has 3 voices, and was last updated by
February 14, 2017 at 8:02 pm #64177ParticipantPoints: 0Rank: Member
This seems to be a "feature" of PowerShell that the -version parameter only seems to work for version 2.0. Does anybody know why that is? Right now, my workstation has v5.0 installed on it, but the servers I'm writing to have v4.0, and I've run into some bugs when I tried to use something I was unaware was new in 5.0, and it would be useful to be able to test the downlevel version without having to throw it up to a server.
Anyone know the thought process behind not supporting that?
February 14, 2017 at 10:03 pm #64191ParticipantPoints: 513Rank: Major Contributor
Starts the specified version of Windows PowerShell. The version that you specify must be installed on the system. If Windows PowerShell 3.0 is installed on the computer, valid values are "2.0" and "3.0". The default value is "3.0".
If Windows PowerShell 3.0 is not installed, the only valid value is "2.0". Other values are ignored.
May have to stick with development of the script on the servers to ensure you're not using Modules or features not in v5 or ISE Steriods has a code compatibility validator that can check code from multiple versions. Not sure if Sapien's Powershell Studio has comparable features.
February 15, 2017 at 1:10 am #64210ParticipantPoints: 0Rank: Member
I'm not really keen on spending money on an ISE module, especially when I almost never use the ISE and don't really care for it overall (I much prefer VS Code).
I definitely don't want to spend almost $400 on PowerShell Studio, when the main attraction of it is building GUIs in the outdated WinForms technology (and it's only a matter of time before the Visual Studio addon works with GUIs as well, and that has a free Community edition I can mess around in and also works for C#).
I was mostly just hoping someone might know why only 2.0 seems to be supported as a launchable downlevel version. I can continue testing on a server for this, but I was hoping I wouldn't have to.
February 15, 2017 at 7:55 am #64225ParticipantPoints: 0Rank: Member
afaik it's was implemented for exchange and sharepoint which require v2 because of modules that require exact .net version
v2 = .net2
The topic ‘powershell.exe -version parameter’ is closed to new replies.