title: Extract operating system version with osversion
body: <p>I created a small program that extracts my operating system version with OSVERSIONINFO APIs.
  My problem is that when I run the program on a Windows 10 Enterprise 2016 LTSB PC it turns out to be VER_SUITE_SINGLEUSERTS instead of VER_SUITE_ENTERPRISE.</p>
  
  <pre><code>Scada.Windows.API.OSVERSIONINFO osvi2 = new Scada.Windows.API.OSVERSIONINFO();
  osvi2.dwOSVersionInfoSize = (uint)Marshal.SizeOf(typeof(Scada.Windows.API.OSVERSIONINFO));
  Scada.Windows.API.GetVersionEx(ref osvi2);
  String osname = String.Empty;
          if (osvi2.dwPlatformId == VER_PLATFORM_WIN32_NT)
          {
              if (osvi2.wProductType == VER_NT_WORKSTATION)
              {
                  if (osvi2.dwMajorVersion == 5 &amp;&amp; osvi2.dwMinorVersion == 0)
                      osname = "Windows 2000";
                  else if (osvi2.dwMajorVersion == 5 &amp;&amp; osvi2.dwMinorVersion == 1)
                      osname = "Windows XP";
                  else if (osvi2.dwMajorVersion == 5 &amp;&amp; osvi2.dwMinorVersion == 2)
                      osname = "Windows XP x64 PRO";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 0)
                      osname = "Windows VISTA";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 1)
                      osname = "Windows 7";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 2)
                      osname = "Windows 8";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 3)
                      osname = "Windows 8.1";
                  else if (osvi2.dwMajorVersion == 10 &amp;&amp; osvi2.dwMinorVersion == 0)
                      osname = "Windows 10";
              }
              else if (osvi2.wProductType == VER_NT_DOMAIN_CONTROLLER ||
                  osvi2.wProductType == VER_NT_SERVER)
              {
                  if (osvi2.dwMajorVersion == 5 &amp;&amp; osvi2.dwMinorVersion == 2)
                      osname = "Windows Server 2003";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 0)
                      osname = "Windows Server 2008";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 1)
                      osname = "Windows Server 2008 R2";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 2)
                      osname = "Windows Server 2012";
                  else if (osvi2.dwMajorVersion == 6 &amp;&amp; osvi2.dwMinorVersion == 3)
                      osname = "Windows Server 2012 R2";
                  else if (osvi2.dwMajorVersion == 10 &amp;&amp; osvi2.dwMinorVersion == 0)
                      osname = "Windows Server 2010";
              }
          }
          osname += " ";
  
          Console.WriteLine(osname);
          //==================================================================
  
          switch (osvi2.wSuiteMask.ToString())
          {
              case "4":
                  txt_Edition.Text = "VER_SUITE_BACKOFFICE";
                  break;
              case "1024":
                  txt_Edition.Text = "VER_SUITE_BLADE";
                  break;
              case "16384":
                  txt_Edition.Text = "VER_SUITE_COMPUTE_SERVER";
                  break;
              case "128":
                  txt_Edition.Text = "VER_SUITE_DATACENTER";
                  break;
              case "2":
                  txt_Edition.Text = "VER_SUITE_ENTERPRISE";
                  break;
              case "64":
                  txt_Edition.Text = "VER_SUITE_EMBEDDEDNT";
                  break;
              case "512":
                  txt_Edition.Text = "VER_SUITE_PERSONAL";
                  break;
              case "256":
                  txt_Edition.Text = "VER_SUITE_SINGLEUSERTS";
                  break;
              case "1":
                  txt_Edition.Text = "VER_SUITE_SMALLBUSINESS";
                  break;
              case "32":
                  txt_Edition.Text = "VER_SUITE_SMALLBUSINESS_RESTRICTED";
                  break;
              case "8192":
                  txt_Edition.Text = "VER_SUITE_STORAGE_SERVER";
                  break;
              case "16":
                  txt_Edition.Text = "VER_SUITE_TERMINAL";
                  break;
              case "32768":
                  txt_Edition.Text = "VER_SUITE_WH_SERVER";
                  break;
          }
  </code></pre>
  
  <p>Do you have any advice on how to extract OS versions?
  I've also tried using this code</p>
  
  <pre><code>var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
  
              string productName = (string)reg.GetValue("ProductName");
  
              txt_PorductName.Text = productName;
  </code></pre>
  
  <p>but I would rather use APIs.</p>