Skip to content

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

@arahja

Description

@arahja

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions