How to determine if you are installing on Windows Client vs. Windows Server.

This question just floated by and I had a similar question recently so I thought I'd capture it here to point search engines in the right direction.

Q: How do I determine if my MSI is being installed on Windows Client or Windows Server?

A: The Windows Installer provides the MsiNTProductType Property that is set to "1" for Workstations (aka: Client) and "2" for Domain Controllers (a Server albeit a rare Server) and "3" for Server (aka: uh, Server).

Here are a couple independent (and hopefully) self-explanatory examples using WiX syntax:

<Condition Message="[ProductName] is a consumer application and is not
supported on Windows Server.">Installed OR 1=MsiNTProductType</Condition>

<Condition Message="[ProductName] modifies the Active Directory and therefore
should only be installed on your Domain Controller.">Installed OR

<Condition Message="Windows Server is required by [ProductName].">Installed OR

Remember the Installed Property is in all of those Conditions to ensure that the MSI can always be uninstalled. It may take some imagination to bypass each Condition (like an OS upgrade) but better safe than sorry.

FireGiant provides dedicated support for the WiX toolset. Ever wish you could get your WiX questions answered immediately with the technical detail that you find in the blog posts here? You can with FireGiant!

Send a comment

Thank you for sending your comment.