The Dynamics AX Setup process involves several components. There is the Setup.exe, the AxSetup.exe and several MSI files (which are Windows Installer Packages). The Setup.exe that is launched usually from the Dynamics AX DVD is extracting the AxSetup.exe to the local Temp folder and executes it. The AxSetup.exe is the typical Setup User Interface you see during a manual setup of Dynamics AX.

After specifying the components to be installed the AxSetup.exe is calling the Windows Installer to e. g. install the Dynamics AX Application Object Server (AOS) or the Dynamics AX Client which are shipped as Windows Installer Packages. While the Dynamics AX Client can only be installed once, multiple instances of the Dynamics AX Application Object Server can be installed.

So the question is how the Dynamics AX Setup determines if an AOS was already installed or how many AOS instances are currently present?

When a new Dynamics AX Application Object Server is installed the AOS Instance gets a GUID assigned. This GUID is used as Windows Installer Product Code. For the Dynamics AX AOS this GUID has a fixed and a variable part. The variable part is the Instance ID of the AOS. So each AOS Instance has its own Windows Installer Product Code.

For example the Product Code for the first Instance of Dynamics AX 2009 AOS (32-bit) would look like:

{F21D51AF-2BB8-4C1D-8272-08BDFC131A01}

The variable part of the Product Code is the Instance Id starting with 01 for the first AOS instance.

Depending on the Dynamics AX version and the machine type different GUIDs for the Product Code are used:

Product Product Code
Dynamics AX 4.0 AOS {06AFEE1A-1415-4EEF-AB3B-5DCA97E85F##}
Dynamics AX 2009 AOS (32-bit) {F21D51AF-2BB8-4C1D-8272-08BDFC131A##}
Dynamics AX 2009 AOS (64-bit) {F21D51AF-2BB8-4C1D-8272-08BDFC1664##}

The Dynamics AX Setup is calling the Windows Installer Function MsiQueryProductState Function to determine if the Product Code per AOS Instance exists.

More information:
The KB article KB884468 - How to programmatically obtain the installation state of Visual Studio .NET or Visual Studio 2005 explains how to call MsiQueryProductState from within managed code.

The Windows Installer Function MsiQueryProductState is looking up the information from the Registry, more concrete from the Registry Key HKEY_CLASSES_ROOT\Installer\Products. The Sub-Keys here represent the Product Code.

Unfortunately the GUID of the Product Code is stored in the Registry not the way you would expect. This is has to do with the fact that GUIDs are internals stored in byte arrays. So what we see in the Registry is the “hex-string” format of the byte arrays.

For example instead of F21D51AF-2BB8-4C1D-8272-08BDFC131A01 you see FA15D12F8BB2D1C4282780DBCF31A110.

Once you know this fact it is however again easy to check for the installed Dynamics AX AOS Instance by looking at the existing Registry Keys.

--author:  Alexander Lachner
--editor: Alexander Lachner
--date: 06/07/2010