Jinjinov / Hardware.Info

Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS.
MIT License
483 stars 77 forks source link

Expose method to get the Windows OS version #29

Closed adhip94 closed 2 years ago

adhip94 commented 2 years ago

Is your feature request related to a problem? Please describe. Retrieve the Windows OS version

Describe the solution you'd like Want to retrieve the Windows OS version.

Describe alternatives you've considered Currently using ManagementObjectSearcher to get the OS version used

using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem"))
{
      foreach (ManagementObject os in searcher.Get())
      {
         OSCaption = os["Caption"].ToString();
         break;
      }
}

Additional context I have seen methods being called to get the windows OS version here. Is it possible to expose this so we can use this in our application to detect the windows version.

Jinjinov commented 2 years ago

Yes, it is possible to expose this method, but... I try to keep this library as cross platform as possible - if I make a new method, I try to implement it in Windows, Linux and macOS.

I could make GetOsVersion() for all three operating systems.

Jinjinov commented 2 years ago

Done: https://github.com/Jinjinov/Hardware.Info/releases/tag/v10.0.1.1