I am working on a windows installer project. And now I only want the software only can be installed on Windows 7 or Windows Server 2008 R2 system, I tried to use this:
Vista and Server 2008 pre-SP2 have the same major version number. You also need to look for the Wix equivalent to 'VER_NT_SERVER' (InstallShield). (at work now, don't have Wix installed here)
You can use the MsiNTProductType
property to detect if it is a server os. In combination with the NT version check you can check if you have Windows Server 2008R2. This would look like the following:
<Condition Message="Windows Server 2008R2 required">
<![CDATA[(VersionNT = 601 AND MsiNTProductType > 1) OR Installed]]>
</Condition>
See https://www.msigeek.com/442/windows-os-version-numbers and https://www.lifewire.com/windows-version-numbers-2625171for an example
<Condition Message='Windows 95'>Version9X = 400</Condition>
<Condition Message='Windows 95 OSR2.5'>Version9X = 400 AND WindowsBuild = 1111</Condition>
<Condition Message='Windows 98'>Version9X = 410</Condition>
<Condition Message='Windows 98 SE'>Version9X = 410 AND WindowsBuild = 2222</Condition>
<Condition Message='Windows ME'>Version9X = 490</Condition>
<Condition Message='Windows NT4'>VersionNT = 400</Condition>
<Condition Message='Windows NT4 SPn'>VersionNT = 400 AND ServicePackLevel = n</Condition>
<Condition Message='Windows 2000'>VersionNT = 500</Condition>
<Condition Message='Windows 2000 SPn'>VersionNT = 500 AND ServicePackLevel = n</Condition>
<Condition Message='Windows XP'>VersionNT = 501</Condition>
<Condition Message='Windows XP SPn'>VersionNT = 501 AND ServicePackLevel = n</Condition>
<Condition Message='Windows XP Home SPn'>VersionNT = 501 AND MsiNTSuitePersonal AND ServicePackLevel = n</Condition>
<Condition Message='Windows Server 2003'>VersionNT = 502</Condition>
<Condition Message='Windows Vista'>VersionNT = 600</Condition>
<Condition Message='Windows Vista SP1'>VersionNT = 600 AND ServicePackLevel = 1</Condition>
<Condition Message='Windows Server 2008'>VersionNT = 600 AND MsiNTProductType = 3</Condition>
<Condition Message='Windows 7'>VersionNT = 601</Condition>
<Condition Message='Windows 8'>VersionNT = 602</Condition>
Just check for VersionNT 601 or newer, Windows 7 and Server 2008 R2 both have the same value.
<Condition Message="Win7 or 2008 R2 required"><![CDATA[Installed OR VersionNT >= 601]]></Condition>