Install resources based on Windows version

No Comments »

A lot of applications use different files or registry entries on different Windows versions. If you want your installer to handle all situations, you need to include the resources for all Windows versions and condition their installation.

This can be done by conditioning the package components (from Component) table with VersionNT or VersionNT64 installer properties. These properties are set automatically by Windows Installer based on the Windows version.

Some newer versions (for example Windows Vista and Windows Server 2008) use the same value for these properties. In this case you can differentiate them through WindowsBuild property.

A further differentiation can be made through ServicePackLevel and MsiNTProductType properties. ServicePackLevel is the actual service pack number and can be “1″, “2″ etc.

Here is a list with possible values for VersionNT, VersionNT64 and WindowsBuild:

Windows versionVersionNT / VersionNT64WindowsBuild
Windows 20005002195
Windows XP5012600
Windows Server 20035023790
Windows Vista6006000
Windows Vista SP16006001
Windows Vista SP26006002
Windows Server 20086006001
Windows Server 2008 SP26006002
Windows 76017100
Windows 7 SP16017601
Windows Server 2008 R26017100
Windows Server 2008 R2 SP16017601

MsiNTProductType can have the following values:

MsiNTProductType valueDescription
1A workstation machine which doesn't use a Windows Server OS. This means it's Windows 7 and not Windows Server 2008 R2.
2A domain controller machine which uses a Windows Server OS. This means it's Windows Server 2008 R2 and not Windows 7.
3A Windows Server machine. This means it's Windows Server 2008 R2 and not Windows 7.

Some sample conditions:

Windows versionCondition
Windows 7 SP1(VersionNT = "601") AND (ServicePackLevel = "1") AND (WindowsBuild >= "7601") AND (MsiNTProductType = "1")
Windows 7(VersionNT = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType = "1")
Windows 7 x64(VersionNT64 = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType = "1")
Windows Server 2008 R2 SP1(VersionNT = "601") AND (ServicePackLevel = "1") AND (WindowsBuild >= "7601") AND (MsiNTProductType <> "1")
Windows Server 2008 R2(VersionNT = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType <> "1")
Windows Server 2008 R2 x64(VersionNT64 = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType <> "1")
Windows Vista SP2(VersionNT = "600") AND (ServicePackLevel = "2") AND (WindowsBuild = "6002") AND (MsiNTProductType = "1")
Windows Vista SP1(VersionNT = "600") AND (ServicePackLevel = "1") AND (WindowsBuild >= "6001") AND (MsiNTProductType = "1")
Windows Vista(VersionNT = "600") AND (WindowsBuild >= "6000") AND (MsiNTProductType = "1")
Windows Vista x64(VersionNT64 = "600") AND (WindowsBuild >= "6000") AND (MsiNTProductType = "1")
Windows Server 2008 SP2(VersionNT = "600") AND (ServicePackLevel = "2") AND (WindowsBuild >= "6002") AND (MsiNTProductType <> "1")
Windows Server 2008(VersionNT = "600") AND (WindowsBuild >= "6001") AND (MsiNTProductType <> "1")
Windows Server 2008 x64(VersionNT64 = "600") AND (WindowsBuild >= "6001") AND (MsiNTProductType <> "1")
Windows XP SP3(VersionNT = "502") AND (ServicePackLevel = "3")
Windows XP x64(VersionNT64 = "502")

Leave a Reply

*
Microsoft Community Contributor Award