title: Identify system operating system by id
body: <p>I want to identify an OS, but not by a <code>String</code> as I want to map this as an ID.
  Several ways of going about this, so my question is:</p>
  
  <p>Does anyone have a list of all the possible answers this produces?</p>
  
  <pre><code>var name = (from x in new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType&lt;System.Management.ManagementObject&gt;()
                      select x.GetPropertyValue("Caption")).FirstOrDefault();
  </code></pre>
  
  <p>Or, is there a way to reverse lookup the <code>Caption</code> field based on any other field?</p>
  
  <p>By looking at <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa394239(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/aa394239(v=vs.85).aspx</a> there doesn't seem to be enough info to recreate the <code>Caption</code> from all the other properties.</p>
  
  <p>Here's a sample of this result on my machine:</p>
  
  <pre><code>BootDevice: \Device\HarddiskVolume1
  BuildNumber: 10586
  BuildType: Multiprocessor Free
  Caption: Microsoft Windows 10 Pro N
  CodeSet: 1252
  CountryCode: 1
  CreationClassName: Win32_OperatingSystem
  CSCreationClassName: Win32_ComputerSystem
  CSDVersion: 
  CSName: DESKTOP-6UJPPDS
  CurrentTimeZone: 120
  DataExecutionPrevention_32BitApplications: True
  DataExecutionPrevention_Available: True
  DataExecutionPrevention_Drivers: True
  DataExecutionPrevention_SupportPolicy: 2
  Debug: False
  Description: 
  Distributed: False
  EncryptionLevel: 256
  ForegroundApplicationBoost: 2
  FreePhysicalMemory: 2027936
  FreeSpaceInPagingFiles: 4486600
  FreeVirtualMemory: 2611432
  InstallDate: 20151223101608.000000+120
  LargeSystemCache: 
  LastBootUpTime: 20160215101020.112003+120
  LocalDateTime: 20160225114508.446000+120
  Locale: 0409
  Manufacturer: Microsoft Corporation
  MaxNumberOfProcesses: 4294967295
  MaxProcessMemorySize: 137438953344
  MUILanguages: System.String[]
  Name: Microsoft Windows 10 Pro N|C:\WINDOWS|\Device\Harddisk0\Partition2
  NumberOfLicensedUsers: 0
  NumberOfProcesses: 157
  NumberOfUsers: 2
  OperatingSystemSKU: 49
  Organization: 
  OSArchitecture: 64-bit
  OSLanguage: 1033
  OSProductSuite: 256
  OSType: 18
  OtherTypeDescription: 
  PAEEnabled: 
  PlusProductID: 
  PlusVersionNumber: 
  PortableOperatingSystem: False
  Primary: True
  ProductType: 1
  RegisteredUser: developer
  SerialNumber: 00332-00331-71784-AA054
  ServicePackMajorVersion: 0
  ServicePackMinorVersion: 0
  SizeStoredInPagingFiles: 4637884
  Status: OK
  SuiteMask: 272
  SystemDevice: \Device\HarddiskVolume2
  SystemDirectory: C:\WINDOWS\system32
  SystemDrive: C:
  TotalSwapSpaceSize: 
  TotalVirtualMemorySize: 12910660
  TotalVisibleMemorySize: 8272776
  Version: 10.0.10586
  WindowsDirectory: C:\WINDOWS
  </code></pre>
  
  <p>Then again that link isn't verbose enough, as Google tells me that <code>OperatingSystemSKU</code> has more than 26 items, as I've found 49 or even 103.</p>
  
  <p>Another route is with <code>Environment.OSVersion</code> but I think it's even worse than what i'm looking at.</p>
  
  <p>So either I build a table for some form of lookup, or I reverse lookup an existing internal library.</p>
  
  <p>My current solution is to get the OS Version and cross-reference a list I made from <a href="https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions" rel="nofollow">https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions</a></p>
  
  <p><strong>Update:</strong>
  Instead of sending a string with the OS Name, to my API, for bandwidth concerns, I want to send a unique ID that I can reverse lookup to retrieve the OS from the ID.</p>
  
  <p>I'm currently building this database dynamically, using the string value of the OS and then an ID every other time.</p>
  
  <p>I would like a solution that can retrieve the <code>Caption</code> field if I have some of the other fields of <code>Win32_OperatingSystem</code> and assuming that both client and server side have the latest dlls/SDKs.</p>
  
  <p>TIA</p>