I have been trying to query Window (XP and Vista) to see if any version of one of our software packages is installed with the UpgradeCode (In this case the UpgradeCode is the only static GUID from version to version). I have tried to do this with WMI and the WindowInstaller.Installer object but have not been successful. I have to write this query from C#. Thanks for any assistance or direction you can provide.
A:
You need to use the MsiEnumRelatedProducts function from MSI.DLL. This link describes how to use it:
http://msdn.microsoft.com/en-us/library/aa370103(VS.85).aspx
It is an unmanaged DLL so you will need to DLLImport it. I am using it in VB.net to check the code.
The key is more than one installed package can have the same upgrade code. If the first call to this returns a package code then you can skip checking again and act accordingly.
Mike
2010-07-21 19:50:32