How to retrieve the product type of Windows Home Server 2011

Windows Home Server 2011 has three product editions:

  • Windows SBS 2011 Essentials incorporates best-of-breed 64-bit product technologies for data backup and restore, remote access, file and printer sharing, and quick connection to the cloud—in one fully integrated solution.
  • Windows Home Server 2011 is the server platform that’s designed specifically for families and how they access their digital data. It helps to simplify and connect your family’s photos, videos, music, and TV by providing a familiar and easy way to share, store, stream, and automatically protect what’s most important. It supports up to 10 users.
  • Windows Storage Server 2008 R2 Essentials is the ideal storage server solution to help home-based and small business owners keep important data automatically backed up, protected, organized, and accessible from virtually anywhere. Built on the Windows Server 2008 R2 operating system, it streamlines access to centralized files for up to 25 users.

If you are writing an addin and you want to know what version your addin is running on, then this simple class will be very helpful to you.

The way we retrieve this information is via the Windows API GetProductInfo:
private const int PRODUCT_HOME_SERVER = 0x22;
private const int PRODUCT_SB_SOLUTION_SERVER = 0x13;
private const int PRODUCT_HOME_PREMIUM_SERVER = 0x32;

private static extern bool GetProductInfo(int dwOSMajorVersion, int dwOSMinorVersion, int dwSpMajorVersion, int dwSpMinorVersion, outuint pdwReturnedProductType);

/// WHS Edition
public enum WHSEdition
/// Unknown Edition
Unknown = 0,
/// Windows Home Server 2011
Standard = 1,
// Windows Small Business Server 2011 Essentials
SmallBusinessEssentials = 2,
/// Windows Storage Server 2008R2
StorageServer = 3

/// Retrieves the WHS Edition that the application is running on
public static WHSEdition GetWHSEdition()
uint pdwReturnedProductType;

out pdwReturnedProductType);

switch (pdwReturnedProductType)
case PRODUCT_HOME_SERVER: return WHSEdition.Standard;
case PRODUCT_SB_SOLUTION_SERVER: return WHSEdition.StorageServer;
case PRODUCT_HOME_PREMIUM_SERVER: return WHSEdition.SmallBusinessEssentials;
default: return WHSEdition.Unknown;

You can download the class sourcefile here.

Tags: , , ,

6 Responses to “How to retrieve the product type of Windows Home Server 2011”

  1. Martin Says:

    thanks for providing this code snippet.
    But I have some doubts regarding following const numbers:
    private const int PRODUCT_HOME_SERVER = 0×22;
    private const int PRODUCT_SB_SOLUTION_SERVER = 0×13;
    private const int PRODUCT_HOME_PREMIUM_SERVER = 0×32;

    Well, as far as I know, these constants shold be:
    private const int PRODUCT_HOME_SERVER = 0×13;
    private const int PRODUCT_HOME_PREMIUM_SERVER = 0×22;
    private const int PRODUCT_SB_SOLUTION_SERVER = 0×32;

    Could you please confirm my guess?

    • asoftblog Says:

      Hi Martin,
      I checked on the WHS versions themselves and they return the numbers I documented.
      However, the numbers you state are indeed the ones documented by Microsoft.

      I am investigating why this is.

      • Martin Says:

        do you already have something new from Microsoft?
        I am still interested in clarifying the differences.

        Meanwhile, I have ordered a license of Windows Home Server 2011. After installing on a test platform next week, I will report the result here.


      • asoftblog Says:

        Hi Martin,

        I have received information last Friday; it seems that the values I use and that I documented are correct; they pointed me here:

        But that means that the constant names are incorrect in the SDK/Windows API documentation.
        I have contacted them about this and am waiting for an answer on that.

        So, you can continue with this code as it is correct and confirmed.


  2. Alexander Kent (@kentdome) Says:

    Nice work =) I am about to tackle this and wanted to double check with you guys if there are any new revelations ?

    • asoftblog Says:

      I contacted Microsoft and they are looking into it.
      Haven’t heard anything back yet. Will ask for a status update.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: