Skip to content

[environment]::OSVersion.Version returns a wrong result of the OS #2009

@jeremylandon

Description

@jeremylandon

Steps to reproduce

[environment]::OSVersion.Version

Expected behavior

Should be return the OS Version

Actual behavior

  • Windows 10 with PowerShell 5 : 10.0.10536.0
  • Windows 10 with PowerShell 6 : 6.2.9200.0
  • Ubuntu : throw an error

Potential error of the problem

The method used by PowerShell must be GetVersionInfoEX (depreciated since Windows 8.1) instead of GetVersionInfo

Environment data

PS C:\> $PSVersionTable

Name                           Value
----                           -----
CLRVersion
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
PSVersion                      6.0.0-alpha
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
PSEdition                      Core
GitCommitId                    v6.0.0-alpha.9
BuildVersion                   3.0.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions