[Solved] How can I find the Windows Edition name [duplicate]


You can get the operating system name from the registry but you need to query WMI for the architecture and the service pack information:

using System.Diagnostics;
...
private string GetOperatingSystemInfo()
{
    RegistryKey operatingSystemKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
    string operatingSystemName = operatingSystemKey.GetValue("ProductName").ToString();

    ConnectionOptions options = new ConnectionOptions();
    // query any machine on the network     
    ManagementScope scope = new ManagementScope("\\\\machineName\\root\\cimv2", options);
    scope.Connect();
    // define a select query
    SelectQuery query = new SelectQuery("SELECT OSArchitecture, CSDVersion FROM Win32_OperatingSystem");
    ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);

    string osArchitecture = "";
    string osServicePack = "";

    foreach (ManagementObject mo in searcher.Get())
    {
        osArchitecture = mo["OSArchitecture"].ToString();
        osServicePack = mo["CSDVersion"].ToString();               
    }            
    return operatingSystemName + " " + osArchitecture + " " + osServicePack;                         
}

If you want more information from WMI, be sure to take a look at the Win32_OperatingSystem class on MSDN.

1

solved How can I find the Windows Edition name [duplicate]