/build/static/layout/Breadcrumb_cap_w.png

Running Bat file during Uninstall

Hi all


is there a way to stop an installed program (.exe) before starting uninstall.

What i have done is I wrote a batch file that accomplish this task. But i don't know how can I run my Bat file in my Setup during Uninstall!!

Can it be done with bach file and how to use them in my setup??

is there any other way

Thanks in adcvance

Best Regards

0 Comments   [ + ] Show comments

Answers (10)

Posted by: Meic 15 years ago
Second Degree Blue Belt
0

To do this, I wouldn't add the bat file to the MSI but would add it to the deployment tool, and specify the batch file to be run before 'uninstall'. This is an option on our dep tool - not sure if it is on yours?
Posted by: anonymous_9363 15 years ago
Red Belt
0
Whichever route - via deployment tool or in the MSI - I'd use a script instead of a batch file. You get much more control, in that you can easily test for return values and such without resorting to the horrors of piping the output to a temporary file and then using FIND (or whatever) to gauge success or failure. You can thus ensure, in a loop, whether or not the process actually got stopped before progressing.
Posted by: daher 15 years ago
Orange Belt
0
Thanks for your replies

I am not familiar with scripting !!!!
can anyone provide me with such script and how to use it where to add it?!


Thanks again
Posted by: anonymous_9363 15 years ago
Red Belt
0
There are innumerable examples on the web. Try http://www.computerperformance.co.uk as a starting point or, as ever, use Google: VBSCript +WMI +process +terminate
Posted by: AngelD 15 years ago
Red Belt
0
Regarding using vbscript wmi to kill a process; have a look at http://forums.altiris.com/messageview.aspx?catid=44&threadid=43062&arctab=arc
Posted by: daher 15 years ago
Orange Belt
0
So far so good!

the next question where and how should i insert this script in my setup?!

note that i want to execute the script during uninstall before the setup attempts to delete the deployed exe files


Thanks for the valuable help
Posted by: AngelD 15 years ago
Red Belt
0
Use a condition of REMOVE~="ALL" and sequence the CA just before the RemoveFiles action in deferred execution
Posted by: daher 15 years ago
Orange Belt
0
got it.


I inserted the script with properties "Processing ASYNC,No Wait".

It worked but seems that the installer is faster then the script so it kept telling me that my installed exe is still running. When i press retry the script is finished and the uninstall continues normally.

so i changed properties "Processing ASYNC,Wait". or Sync... Then i got error 1720 and i could never uninstall since it tells "a script is required for this install to complete could not be finished",
Even if I set back the property to ASYNC,No Wait i still get this error.

So how can i Unistall without getting this synchronisation problem.!!!

and how can i make my setup waits for the the script to finish without getting this error?!

Here is the script:


For Each Process In GetObject("winmgmts:{impersonationLevel=impersonate}!//localhost").ExecQuery("select * from Win32_Process WHERE Name ='calc.exe'")
Process.Terminate
Next
wscript.quit(0)


Thanks again!!!
Posted by: AngelD 15 years ago
Red Belt
0
Remove wscript.quit(0) and you should be fine.
Posted by: anonymous_9363 15 years ago
Red Belt
0
...and set the CA to wait.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ