cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
eladef
Level 7

Detect only Server 2008 R2 ?

Hi

I have basic MSI
Any way ( with install script or system search ) I can detect ONLY Server 2008 R2 ? ( without Win 7 )
Labels (1)
0 Kudos
(7) Replies
palanisamy
Level 7

Try below installscript to obtain windows OS is 2008R2

if (SYSINFO.nISOSL = ISOSL_WIN7_SERVER2008R2) then
if SYSINFO.nOSProductType = VER_NT_WORKSTATION then
// Windows 7
else
// Windows 2008 R2
endif;
endif;

Please check following link for more information http://msdn.microsoft.com/en-us/library/ms724833
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

For a basic MSI, I'd suggest referencing the MsiNTProductType Property in concert with the VersionNT property you're likely already using.
0 Kudos
Ron_Schaeffer
Level 6

Take a look at this:
http://msdn.microsoft.com/en-us/library/aa370556(v=VS.85).aspx

You should be able to use properties VersionNT and WindowsBuild to differentiate 2008 R2 from Win7.
0 Kudos
palanisamy
Level 7

Hi Ron Schaeffer,

I refer the MSDN site, both windows7 and 2008 R2 VersionNT and WindowsBuild properties Values are same(601, greater than 7100) .

Please provide example how to differentiate using VersionNT and WindowsBuild ?
0 Kudos
Ron_Schaeffer
Level 6

I don't have an example, as I haven't had to do this - I was just trying to provide a link I found that may lead you to a solution.

In that link, there is a comment/question regarding Windows 7 and Windows Server 2008 R2:

VersionNT and VersionNT64 are 601 for Windows 7 and Windows Server 2008 R2. Again, use MsiNTProductType to differentiate (as with Vista vs 2008).

You'll have to research what is meant by this.
0 Kudos
mloebl
Level 4

Not the most elegant solution, but I created a custom action to call a function in my managed DLL using WMI that's based on this -
http://andrewensley.com/2009/10/c-detect-windows-os-version-%E2%80%93-part-2-wmi/

I clean up the output a bit more than the example, set a property to it's results, and then use that for my comparison tests. There are a ton of different c# examples out there, but a lot of them seem to have the same "VersionNT" and "MsiNTProductType" type challenges I was finding when I played with this recently. There's got to be a more elegant way 🙂

-Mike
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

There's no need to spin up a custom action for this sort of thing. A condition to check that you're running on (at least) Windows Server 2008 R2 should look like VersionNT >= 601 AND MsiNTProductType > 1 whereas a check for exactly Windows 7 that excludes Server variants should look lik VersionNT = 601 AND MsiNTProductType = 1. To check for a 64-bit OS, substitute VersionNT64 for VersionNT. To require a 64-bit OS, consider changing the template summary, although that yields control of the message to Windows Installer.
0 Kudos