cancel
Showing results for 
Search instead for 
Did you mean: 

Identifying Windows 10 with MSI

Identifying Windows 10 with MSI

Summary

How to identify Windows 10

Symptoms

Prior to Windows 10 it was possible to use the Windows Installer property VersionNT to determine the version of the operating system.
For Example: Windows 7 VersionNT=601, Windows 8=602, Windows 8.1=603.

Windows 10 has a VersionNT value of 603. An MSI will therefore identify the OS as Windows 8.1.

Cause

The issue is the value returned by the GetVersionEx API on operating systems from Windows 8.1 onwards.

The Value returned by GetVersionEx API now depends on how the application is manifested. The applicaion responsible for running MSI's is msiexec.exe which contains no Windows 10 information in its manifest on a Windows 10 machine. A sample of the msiexec.exe manifest file shipped with Windows 10 can be seen below:

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
        <application> 
            <!-- Windows BLUE -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
        </application>

The supportedOS Id GUID used here is for Windows 8.1 and does not contain any Windows 10 details.

Resolution

It is possible to identify Windows 10 by using a setup.exe bootstrapper.

This ability is built into InstallShield's Suite Project - the setup.exe manifest in use with InstallShield 2015 contains Windows 10 specific information, see below:

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
	<application>
		<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
		<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
		<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
	</application>






By wrapping your MSI with an InstallShield Suite Project you can use a platform condition with an OS Version value of 10.0 to identify Windows 10.
The example below shows an Exit Condition which launches a message box and prevents the MSI from launching if run on a Windows 10 machine.


User-added image


An alternative solution within the Suite project is to use the Object Expressions introduced in InstallShield 2015. Using this approach we can create a Property within the packaged MSI to hold the Windows 10 OS version number. The following expression can be entered as the value of the "MSI Command Line" property on an MSI package included in a suite:

REALVERSIONNT=[@Platform.MajorVersion]

User-added image


If the suite is run on a Windows 10 machine this expression will create the Property REALVERSIONNT with a value of 10 within the targeted MSI.
This property can then be used as an install condition on the actual MSI to prevent installs on a Windows 10 machine. For example:

NOT REALVERSIONNT=10

Workaround

If using Suite installers is not an option, the following workaround may be something to consider but should be used with caution.

Within a Basic MSI project we can use a System Search > Registry Entry to locate a registry which is new within Windows 10 OS's:

User-added image

On Windows 10, this value will be 10. If we then store this in a Property and use it as an Install Condition, we can control the behaviour of the MSI on Windows 10 machines.

This approach should however be used with caution as there is no guarantee that Microsoft will not remove or edit this registry key in future updates or releases of Windows 10. If this occurs this would add additional maintenance to your application.

Additional Information

In summary due to changes in the behaviour of Windows 10 it is not possible to reliably identify a Windows 10 Operating System from within an MSI.
The solution is to use a setup.exe which targets Windows 10 within its manifest file.

The same behavior occurs with the Windows Installer property WindowsBuild. This property will report as 9600 which is the value for Windows 8.1

Related Documents

SupportOS Id GUID values can be found here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx

VersionNT usage on Windows 10:
https://social.technet.microsoft.com/Forums/en-US/1c8be9b3-a8be-4070-b8e9-51f3c5448c5c/windows-10-ms...

GeVersionEx Function:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451%28v=vs.85%29.aspx
Was this article helpful? Yes No
No ratings