Barvaz
Pilgrim

LaunchApplication

Hi,

I've problem to use LaunchApplication command - I have not found yet the exact flags with them I have to run the command.
I want to run msiexec command to uninstall third party application and WAIT until the uninstallion process will be completed.
I'm using the following code:

uninstallParams = "/q /x {10277218-0100-0904-9ABB-000BDB5CF35D} " + sLogParam;

if ( LaunchApplication ("msiexec", uninstallParams, "", SW_HIDE, INFINITE,LAAW_OPTION_USE_SHELLEXECUTE|LAAW_OPTION_WAIT) < ISERR_SUCCESS ) then
Message = "Error while third party uninstall";
MessageBox(Message,SEVERE);

else
Message = "Third party complitly uninstalled";
MessageBox(Message,SEVERE);

endif;


Please help me to understand what is wrong in my command.
Thanks,
Labels (1)
0 Kudos
7 Replies
Cygnusx1
Flexera beginner

Re: LaunchApplication

A .msi can only uninstall a separate app IF the .msi installed it. This is a nested installation.
0 Kudos
joshstechnij
Flexera
Flexera

Re: LaunchApplication

We would recommend passing WINSYSDIR ^ "msiexec.exe" in the program parameter so that an explicit path is provided on where to launch msiexec from.

If an executable fails to launch with LaunchApplication, it is recommended that the LAAW_PARAMETERS.nLaunchResult value be checked to determine what system error was returned while trying to launch the EXE.

Also, since the sLogParam value is unknown based on the posted code, please ensure this parameter to msiexec is correct. If it is not, msiexec will run and then exit immediately with an error.
0 Kudos
Barvaz
Pilgrim

Re: LaunchApplication

I Run Setup.exe to perform silent uninstall and i didn't found the suitable LaunchApplication command to uninstall the Third-Party program.
I need to launce the uninstall command and WAIT until it finish! Only after the uninstalling command ended check the return code and if it's OK then continue the program.
Currently my program print the OK message without launch the command even not to the background.

My code is:

uninstallParams = "/q /x {10277218-0100-0904-9ABB-000BDB5CF35D} c:\temp\test.log"
ret = LaunchApplication(WINSYSDIR^"msiexec.exe", uninstallParams, "", SW_HIDE, INFINITE, LAAW_OPTION_USE_SHELLEXECUTE | LAAW_OPTION_WAIT_INCL_CHILD );
if (ret < 0 ) then
Message = "Error while third party uninstall";
MessageBox(Message,SEVERE);

else
Message = "Third party completely uninstalled";
MessageBox(Message,SEVERE);

endif;


I checked successfully the Third-Party uninstall command by print it to message box cut and run it from command line.
Please advice
0 Kudos
Holger_G
Pilgrim

Re: LaunchApplication

Your uninstallParams variable contains a incorrect escape sequence for the log file path. \\ inserts a backslash.

Try this code:


function UninstallThirdParty(hMSI)
STRING szApp, szParams;
STRING szTempPath;
STRING szLogFilePath;
STRING Message;
begin
GetEnvVar ( "TEMP", szTempPath );
szLogFilePath = szTempPath ^ "test.log";
szApp = WINSYSDIR^"msiexec.exe";
LongPathToQuote (szApp, TRUE);
szParams = "/x {10277218-0100-0904-9ABB-000BDB5CF35D} /qn /lv* " + szLogFilePath;
if (ISERR_SUCCESS == LaunchApplication(szApp, szParams, "", SW_NORMAL, LAAW_PARAMETERS.nTimeOut, LAAW_OPTION_USE_SHELLEXECUTE|LAAW_OPTION_WAIT|LAAW_OPTION_SHOW_HOURGLASS)) then
if (0 == LAAW_PARAMETERS.nLaunchResult) then
Message = "Third party completely uninstalled";
MessageBox(Message,SEVERE);
else
SprintfMsiLog("### LaunchApplication failed: %d", LAAW_PARAMETERS.nLaunchResult );
Message = "Error while third party uninstall";
MessageBox(Message,SEVERE);
endif;
else
SprintfMsiLog("LaunchApplication failed");
endif;
end;



Info:
You should note that you may need elevated privileges to perform the uninstallation. If you trigger the script as a custom action from within MSI based setup you can only run the uninstall during the UI sequence.

(SprintfMsiLog does not work from custom actions launched through DoAction events.)
0 Kudos
Barvaz
Pilgrim

Re: LaunchApplication

Why can i run the uninstall process during the UI only?
Currently i launch it as Execute action and it failed with error 1618.
1618: ERROR_INSTALL_ALREADY_RUNNING -Another installation is in progress. Only one installation at a time can run actions in the InstallExecuteSequence, AdminExecuteSequence, or AdvtExecuteSequence tables.

I don't understand the problem - Please explain.
Remember i run the uninstall process by setup.exe file which launch msiexec to uninstall the third-party

Thanks
0 Kudos
Holger_G
Pilgrim

Re: LaunchApplication

Please follow up on this thread, with regard to error 1618 and LaunchApplication.
0 Kudos
Barvaz
Pilgrim

Re: LaunchApplication

I not really understand How it can uninstall Third-Parties with msiexec in UI mode (ARP), and not do the same in silent mode?
0 Kudos