I want to identify the OS, but not using String , since I want to map this as an identifier. Several ways to do this, so my question is:
Does anyone have a list of all the possible answers he gives?
var name = (from x in new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType<System.Management.ManagementObject>() select x.GetPropertyValue("Caption")).FirstOrDefault();
Or is there a way to reverse search the Caption field based on any other field?
Looking at https://msdn.microsoft.com/en-us/library/windows/desktop/aa394239(v=vs.85).aspx , it seems like there is not enough information to recreate Caption from all other properties.
Here is an example of this result on my machine:
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
Then again, this link is not detailed enough, since Google tells me that OperatingSystemSKU has more than 26 elements, since I found 49 or even 103.
Another route is with Environment.OSVersion , but I think it is even worse than what I am looking at.
Thus, either I create a table for some form of search, or reverse lookup an existing internal library.
My current solution is to get the OS version and cross-reference the list I made from https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
Update: Instead of sending a string with the name of the OS to my API, for bandwidth problems, I want to send a unique identifier that I can cancel to extract the OS from the identifier.
I am currently creating this database dynamically using the string value of the OS and then the identifier each time.
I would like to get a solution that the Caption field can get if I have some other Win32_OperatingSystem fields and it is assumed that there are recent dll / SDKs on the client and server side.
TIA