Here is a collection of approaches I’ve pulled together from my archives for telling if MSMQ is installed without being able to physically go and bring up Computer Management to check yourself. Please feel free to let me know if you have developed any of your own tricks to do this.
Points 5.12 and 5.13 are from the MSMQ FAQ:
Yes. Try to load Mqrt.dll (using the LoadLibrary API).
· For MSMQ 1.0 and 2.0, the DLL file is not present on the disk if Message Queuing is not installed and so you won’t be able to load it.
· For MSMQ 3.0, the Message Queuing binaries are always present on the disk, but trying to load Mqrt.dll fails with ERROR_DLL_INIT_FAILED if Message Queuing is not installed.
For MSMQ 2.0 and 3.0:
When this value is set to 1, the computer can be used as a supporting server for remote dependent clients.
When this value is set to 1 (domain controller only), the computer provides Active Directory access for MSMQ 1.0 and Message Queuing 2.0 clients. This value is always set to 1 on Windows 2000 domain controllers. It is set to 1 on Windows Server 2003 domain controllers only if you installed the Message Queuing Downlevel Client Support service
When this value is set to 1, the computer is configured as a Message Queuing routing server.
How to tell if MSMQ is running:
Use the Service Control Manager (SCM) API.
[[Edited 8th September, 2009]]
How to tell what version of MSMQ is installed:
Query the HKLMSOFTWAREMicrosoftMSMQParametersCurrentBuild registry value
5.0.xxx is MSMQ 2.0 (Windows 2000)
5.1.xxx is MSMQ 3.0 (Windows XP)
5.2.xxx is MSMQ 3.0 (Windows 2003)
6.0.xxx is MSMQ 4.0 (Windows Vista and 2008 R1)
6.1.xxx is MSMQ 5.0 (Windows 7 and 2008 R2)
The MSMQ version number shouldn’t change with service packs.
Here is a C# sample that uses WMI to check if the service is installed. If it is, the code obtains the file used to start the service and queries it for version information:
string version = FileVersionInfo.GetVersionInfo(new ManagementObject(“Win32_Service.Name=”MSMQ””).Properties[“PathName”].Value.ToString()).ProductVersion;
How to tell what components are installed:
Query the HKLMSOFTWAREMicrosoftMSMQParametersSetup registry key. Each registry value should exist if the corresponding subcomponent is installed, and not exist if the subcomponent is not installed. Each should also be 1 (not 0):
Msmq_Core (MSMQ 3.0 and below)
Msmq_CoreInstalled (MSMQ 4.0)
Windows 2000 Support value:
msmq_MQDSService (MSMQ 3.0 and below)
msmq_MQDSServiceInstalled (MSMQ 4.0)
msmq_Multicast (MSMQ 3.0 and below)
msmq_MulticastInstalled (MSMQ 4.0)
msmq_RoutingInstalled (MSMQ 4.0)
msmq_RoutingSupport (MSMQ 3.0 and below)
msmq_TriggersInstalled (MSMQ 4.0)
msmq_TriggersService (MSMQ 3.0 and below)
Active Directory value:
Note – if you want to verify that MSMQ is actually Active Directory Integrated (not just that Active Directory is installed), you want to check:
HKLMSoftwareMicrosoftMSMQParametersWorkgroup (value should be 0 or not present)
HKLMSoftwareMicrosoftMSMQParametersSetupCreateMsmqObj (value should exist and be 0; the absence of this key doesn’t necessarily indicate a problem)
The HKLMSoftwareMicrosoftMSMQParametersWorkgroup value can be missing if MSMQ Active Directory Integration is installed and MSMQ is successfully operating in domain mode. The presence of this value depends on whether Active Directory Integration was installed before or after the machine was joined to the domain, and whether MSMQ has previously had any failures in contacting the domain controller. Regardless, this key only indicates a problem if its value is 1 and MSMQ is supposed to be Active Directory Integrated.