Search code examples
wixwindows-installersystemconditional-statements

How to check the system is Windows 7 or Windows Server 2008 R2 in Wix Installer?


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:

<Condition Message='Windows Server 2008 R2 or Windows 7 is required'>(VersionNT = 600 AND ServicePackLevel = 1) OR VersionNT = 601 </Condition>

but it can still be installed on Windows Vista. Please help!

Thank you!


Solution

  • 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>