Need to launch a EXE if a registry key exists - Advanced Installer Community
cxnoel
Posts: 6
Joined: Mon Jun 18, 2012 7:09 pm

Need to launch a EXE if a registry key exists

I need to uninstall a previous version which was not installed from a MSI. The file to execute to proceed with the uninstall is found in the Registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ApplicationName\QuietUninstallString). So I created a Registry Location Search object (V7_PATH) using the following properties:

Root: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ApplicationName
Name: QuietUninstallString
Type: Retrieve the raw value

This Search object works file as it returns the value. Now, I wish to execute the returned value when it exists. I created a Launch EXE With Working Directory to be executed after the InstallFinalize stage, with the following properties:

File path: [v7_PATH] (this value contains the full path and includes a /silent parameter)
Command Line:
Working Directory: SystemFolder
Execution time: Immediately
Execution options: Nothing checked.
Execution Stage: Install
Condition: V7_PATH <> ""

Doesn't work :( What's wrong?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Need to launch a EXE if a registry key exists

Hi,

The approach you use is correct, but please keep in mind that in order to launch a file using a property as its path, you should use the Launch file from property custom action. Can you try that and see if it works?

Please note that the command line argument (/silent) should not be included in the file's path, it should be written in the "Command Line" field of the custom action.

If it does not work, can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com, so we can investigate them?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cxnoel
Posts: 6
Joined: Mon Jun 18, 2012 7:09 pm

Re: Need to launch a EXE if a registry key exists

Almost there! First, I had to change the condition because V7_PATH <> "" was returning false. So I created a V7_EXISTS from a Registry Key Exists search which returns 0 or 1 and, in my case, successfully returns 1.
However, the execute path is launched as expected but returns code 1631 which is ERROR_CREATE_FAILED : The Windows Installer service failed to start.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Need to launch a EXE if a registry key exists

Hi,

That seem to be a known Windows Installer issue, as it is discussed on the following Microsoft's web page:
http://support.microsoft.com/default.as ... -us;251274

However it may not appear on all the machines. Can you test the package on multiple clean machines and see if the problem persists?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cxnoel
Posts: 6
Joined: Mon Jun 18, 2012 7:09 pm

Re: Need to launch a EXE if a registry key exists

Even if the article refers to Windows NT4, I checked the registry entries and there was no NULL values. However, I tested the package on a second Win7 computer andf the same result. Can it be because the actual instance of the installer is not completed before it launches a new one?

Here are the Launch File From Property values, executed after the InstallFinalize stage:

Property: V7_PATH (contains "C:\ePigeon\Client\un_ePigeonClientSetup_27567.exe", double quotes included)
File type: Executable (*.exe)
Command line: /Silent

Execution Time: Immediately (no other choice)
Execution Options: All unchecked
Execution Stage: Install
Condition: V7_CLIENT_EXISTS = "1" (works fine)
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Need to launch a EXE if a registry key exists

Hi,

I'm not sure why you encounter this problem. Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com, so we can investigate them?

A link to download your packages (the main package and the one that is launched by the custom action) and test them on our machines will be really helpful.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Need to launch a EXE if a registry key exists

Hi,

After more investigation on the files that you sent me over email, I found that the problem appears because of the double quotes that are contained by the V7_PATH property. That value is stored in the registry enclosed in double quotes and the installer takes it as it is.

So, in order to overcome the problem, you can create a simple custom action that removes the double quotes from that property.

Below is an example of a VBScript custom action to achieve that:

Code: Select all

txt = Session.Property("V7_PATH")
Session.Property("V7_PATH") = replace(txt,"""","")
Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cxnoel
Posts: 6
Joined: Mon Jun 18, 2012 7:09 pm

Re: Need to launch a EXE if a registry key exists

Still no luck :(

I added the script file as suggested. However, when I look into the log file, I see only 1 line where the property has the double quotes removed. The last print of the value still shows the quotes. So I modified the script to create a new variable: V7_PATH_MOD:

txt = Session.Property("V7_PATH")
Session.Property("V7_PATH_MOD") = replace(txt,"""","")

The property is successfuly created and the Launch File From Property uses this new property. But I am still getting error code 1631.

BTW: I added a MessageBox custom action just before the Launch File From Property and it shows up before the ExitDialog appears, which let me think that the current MSI is not completed before the uninstall process starts, which is also an MSI. Could that be the reason why I get error 1631?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Need to launch a EXE if a registry key exists

Hi,

I'm not sure why the problem still persists on your machine, but I tested it on my machine using the resources that you sent and it worked well. Can you please send me the modified .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com, so I can investigate them?
BTW: I added a MessageBox custom action just before the Launch File From Property and it shows up before the ExitDialog appears, which let me think that the current MSI is not completed before the uninstall process starts, which is also an MSI. Could that be the reason why I get error 1631?
Indeed, the "Launch file from property" custom action is executed before the "ExitDialog" appears, but this is normal and it is not a problem because the old product that should be uninstalled is not a MSI-based product.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cxnoel
Posts: 6
Joined: Mon Jun 18, 2012 7:09 pm

Re: Need to launch a EXE if a registry key exists

OK. I found the problem: I was launching MSIEXEC from a non-elevated command line window :oops:

Thanks a lot for your assistance.

Claude
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Need to launch a EXE if a registry key exists

You're welcome Claude. Glad to help.

Just let us know anytime you have a problem.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”