8

On Windows 10, the VB.NET code Environment.OS.VersionString outputs Microsoft Windows NT 6.3.9600.0. According to Microsoft documentation, Windows 10's version number is 10.0, so why does VB.NET recognise Windows 10 as Windows 8.1?

I did systeminfo | findstr /C:"OS" in Command Prompt and it returned the correct value of 10.0.10240 N/A Build 10240 under "OS Version".

Dog Lover
  • 352

4 Answers4

3

Because it is picking up the fact you upgraded from Windows 8.1. The method you are using is looking at the registry. It is working as intended. There is a more appropriate function then using the environment variable to determine what operating system is being used. I can't provide code since this isn't Stackoverflow

– Ramhound Aug 26 at 1:12

That's the answer in a nutshell. During the upgrade, the registry doesn't change the build number from the old to the new one. It just sticks.

Roke
  • 1,052
0

So, to get back to the root question... I use Windows Management Instrumentation (WMI) to generate the Windows version number in the manner in which you are expecting. For example, it reports 10.0.10586

Here is a short code snippet

Public Class OS

' Use Windows Management Instrumentation (WMI) to get the OS version
    Public Shared Function GetOSVersion() As String
        Dim answer As String = ""

        ' add Imports System.Management and add a resource to System.Management
        Dim osClass As New ManagementClass("Win32_OperatingSystem")
        For Each queryObj As ManagementObject In osClass.GetInstances()
            answer = DirectCast(queryObj.GetPropertyValue("Version"), String)
        Next

        Return answer
    End Function
End Class
egray
  • 715
  • 4
  • 9
0

That's because you were reading CurrentVersion from HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion and, as has already been said, that entry doesn't get updated change with Windows updates.

The entries to check are CurrentMajorVersionNumber, CurrentMinorVersionNumber and CurrentBuildNumber, in the same key.

Nuno André
  • 243
  • 2
  • 7
-2

6.3 is the internal version of Windows, which reveals that since Windows 7, there have not been any major releases, contrary to what Microsoft wants you to believe. The names Windows 7, 8, 10, etc. are just marketing names. They decided to skip 9 to match Mac OS X. But the real version number is 6.3

user319563
  • 27
  • 2