11

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!

saschabeaumont
  • 22,080
  • 4
  • 63
  • 85
Ray
  • 1,893
  • 7
  • 22
  • 24
  • 1
    Here you have the microsoft page about windows versions: http://msdn.microsoft.com/en-us/library/windows/desktop/aa370556(v=vs.85).aspx –  Mar 23 '12 at 08:49

4 Answers4

25

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>
Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
10

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>
saschabeaumont
  • 22,080
  • 4
  • 63
  • 85
  • additional note: the original poster asked how to check for one particular OS version - using the operator "=". this is a big mistake that should never ever be done! instead we need to use the operator ">=". this is already included in the current answer by saschabeaumont. i just want to point out that the requirement as outlined in the initial question is kind of invalid. we need to avoid such mistakes. – Opmet May 01 '13 at 09:50
6

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>
GDP
  • 8,109
  • 6
  • 45
  • 82
1

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)

DaveE
  • 3,579
  • 28
  • 31