8000 Powershell Core Reports the wrong version of windows when referencing c# Assemblies · Issue #6452 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Powershell Core Reports the wrong version of windows when referencing c# Assemblies #6452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arahja opened this issue Mar 21, 2018 · 3 comments · Fixed by #6457
Closed

Powershell Core Reports the wrong version of windows when referencing c# Assemblies #6452

arahja opened this issue Mar 21, 2018 · 3 comments · Fixed by #6457
Assignees
Labels
Area-Maintainers-Build specific to affecting the build Resolution-Fixed The issue is fixed.

Comments

@arahja
Copy link
arahja commented Mar 21, 2018

I apologize if this issue already exists and I missed it or if you are already aware of this issue. This is my first time submitting an issue here.

When using the System.Environment assembly to get the Windows OS version that is it running PowerShell reports the same version of Windows as Windows 8/Windows Server 2012 instead of the correct version of Windows on Windows 8.1/Windows Server 2012R2 and Windows 10/Windows Server 2016. I found a stackoverflow article referencing Windows Developer document. It is probably not this simple but you might need to modify your manifest file for your PowerShell builds.

Steps to reproduce

[System.Environment]::OSVersion.Version

Expected behavior

[System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      16299  0

Actual behavior

[System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
6      2      9200   0

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.2
PSEdition                      Core
GitCommitId                    v6.0.2
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@MaximoTrinidad
Copy link
MaximoTrinidad commented Mar 21, 2018

@arahja,

I don't think the results relates to the actual Windows OS Build. It's something else:

PS [81] > [System.Environment]::OSVersion.VersionString
Microsoft Windows NT 6.2.9200.0

PS [70] > cmd
C:\Program Files\PowerShell\6.0.2>ver
Microsoft Windows [Version 10.0.17127.1]

PS [84] > $PSVersionTable.os
Microsoft Windows 10.0.17127

I'm sure it's the internal Windows Build version.
:)

@MaximoTrinidad
Copy link
MaximoTrinidad commented Mar 21, 2018

Ah! I forgot to include the following link which shows the Windows OS Version numbers:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

OK! So, this confirms that the versions are incorrect!
Good one @arahja!

But, this is not PowerShell, it's in .NET Environment Class:
https://msdn.microsoft.com/en-us/library/system.environment.osversion(v=vs.100).aspx

:)

@arahja
Copy link
Author
arahja commented Mar 21, 2018

You might find the following text in Windows Developer document interesting:

* For applications that have been manifested for Windows 8.1 or Windows 10. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). To manifest your applications for Windows 8.1 or Windows 10, refer to Targeting your application for Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Maintainers-Build specific to affecting the build Resolution-Fixed The issue is fixed.
Projects
None yet
4 participants
0