0

I would like to know if there is a possibility other than from registry to find the OS edition. I don't mean version like Win7, 10, etc., but Home, Professional, Enterprise, etc.

Even when I find it in the registry there is "Enterprise" on Pro version of Windows 10.

I just need to know how to achieve that on Windows 10.

I found this article:

Detect Windows version in .net

But I dont see an option for Environment.OSVersion to return edition of windows.

Is it maybe possible through WMI?

Palle Due
  • 5,929
  • 4
  • 17
  • 32
Johny Wave
  • 111
  • 2
  • 11
  • @BrootsWaymb Yes,thank you, didnt showed up in google for some reason when i googled how to get windows edition in C#... – Johny Wave Dec 18 '19 at 14:46

1 Answers1

2

This is a simple way to do it using WMI

using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
{
    var obj = searcher.Get().Cast<ManagementBaseObject>().FirstOrDefault();
    string version = obj["Caption"].ToString();                 //Microsoft Windows 10 Home
    string architecture = obj["OSArchitecture"].ToString();     //64-bit
}
Innat3
  • 3,561
  • 2
  • 11
  • 29