If we need to check what Windows version a PowerShell script run on, we usually use a statement like this:
So imagine our surprise when we saw what happens when you run this as a script in PrimalScript:
Instead of reporting the actual Windows version, it appears as if we are running in Windows 8 instead of 8.1
To make sure we didn’t have a glitch in PrimalScript (and because we didn’t quite trust our eyes), we packaged the script as an executable and ran that.
Same result, it reports the incorrect version number.
According to Microsoft this is intentional:
Before you ask, we have no idea what could possibly possess Microsoft to break such a fundamental API call so that it reports an incorrect version.
As shown on the web page we linked to above, you have to tag your executable in a manifest as supporting Windows 8.1 in order to get a correct version number.
In the packager settings you have to switch to a custom manifest and and specify the manifest file.
If you follow this patch and re-package the executable it will now report the correct version number.
Needless to say, we will update our default manifest and the packager to accommodate this latest “it’s not a bug, it’s a feature” play by Microsoft in the next service build.