Sometimes you might want to check for which Windows “edition” is installed on a computer. Let’s say you’ve made an app that you want to be free for personal use, but want to force enterprises to pay a licensing fee if they want to use it in their environment.

A quick and dirty registry key check performed in the startup sequence of your application can be enough to find whether the Windows “edition” installed is Home Basic, Home Premium, Ultimate or Enterprise.

To determine which Windows Edition a computer is installed with, simply check the value of the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID

A simple example (in pseudo code) to test for this registry key value in C#:

  • First, use the Microsoft.Win32.RegistryKey class (click the link for details about the class at MSDN)
  • Then use OpenSubKey to open HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
  • You then call GetSubKeyNames to fetch the names of the subkeys under CurrentVersion
  • Call GetValue for the key value you want, which in this case would be EditionID
  • Check if the value matches Enterprise. If the value is a match, you might want to display a warning or ask for a serial key to allow the user to use the application

There’re more potentially helpful registry keys under the CurrentVersion path, here’s a list of a few of them (I chose to leave out the most obscure ones):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber

The current build number. Both of these keys have the same value whenever I have checked. My Windows 7 SP1 Ultimate has a build number of 7601.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion

The current “version” of Windows. My Windows 7 SP1 Ultimate has the version number “6.1”.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallationType

The installation type. Has the value of “Client” on my computer. Can be “Server” on servers like Windows 2008 R2.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName

The “marketing name” of the current Windows installation. On my computer the value is “Windows 7 Ultimate”.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization

Empty value on my PC, this value is usually populated with the company name in an Enterprise installaton.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOwner

Contains the name of the “owner”. Usually the same as the first user name that is created during setup, or company name in an Enterprise install.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion

The name of the latest service pack installed, if any. Can be empty if no service pack is installed. On my PC the value is “Service Pack 1”.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDBuildNumber

The build number of the latest service pack installed, if any. Can be empty if no service pack is installed. On my PC the value is “1130”.

LogParser method:

If performing many queries against the registry or other parts of the system, check out the little known Microsoft tool Log Parser. Log Parser can query the registry, file system, system event log or even values inside of XML and CSV files.

To use LogParser within C#, you need to build an Interop Assembly from the Logparser.dll COM server using the following command (correct the path to your installation of Log Parser, for exampe to “Program Files (x86)” on 64-bit systems):

tlbimp "C:\Program Files\Log Parser 2.2\LogParser.dll" /out:Interop.MSUtil.dll

Example usage:

using System;
using System.Runtime.InteropServices;
using LogQuery = Interop.MSUtil.LogQueryClass;
using RegistryInputFormat = Interop.MSUtil.COMRegistryInputContextClass;
using RegRecordSet = Interop.MSUtil.ILogRecordset;

class Program
public static void Main()
RegRecordSet registryRecords = null;
LogQuery qry = new LogQuery();
RegistryInputFormat registryFormat = new RegistryInputFormat();
string query = @"SELECT Path from \HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion where Value='Enterprise'";
registryRecords=qry.Execute(query, registryFormat);
for(; !registryRecords.atEnd(); registryRecords.moveNext())

Code example source