View Full Version : vbscript CA to abort uninstall

10-24-2003, 09:40 AM
I want to use a vbscript custom action to warn Windows 2000 users when uninstalling a particular application.
The vbscript called after Launch Conditions in the exe sequence ( with condition REMOVE="ALL" returns the value 3 to the msi under certain conditions.
the user sees a warning message box but they still has the choice to continue and the uninstall completes as normal or to abort the uninstall.
I have this working except that if the user chooses to cancel the uninstall a message box appears saying "Fatal Error during Installation".
(Also for some reason, this message box appears twice though the custom action is only called once).
Is there some other value that I should return that will cancel the uninstall sequence but not bring up this error.
Or is there another way completely to get around this issue ?

03-26-2004, 11:13 AM
DId you ever fing out the solution? I'm seeing the same problem and am seeking the answer. THanks.

03-26-2004, 11:18 AM
Perhaps, please take a look at http://www.installshield.com/news/newsletter/0308-articles/msi.asp?

03-29-2004, 05:51 AM
Yes I did figure out how to do this and it is explained well in the User Documentation describes above. For an even simpler explanation these were my steps to aborting the installation via vbscript

1. Use non 38 type custom action ( ie not embedded)
2. Call a function eg MyTestFunction
3. Have the function return the number 3

eg MyTestFunction

Function MyTestFunction()
If something then
MyTestFunction = 3
End Function

4. Have the Custom action Target specify the function name ie MyTestFunction

03-29-2004, 11:51 AM
After trying different methods:
abort, exit, Do(EXIT), and the vbscript Custom action like in the article, I still get the "Fatal Error during Installation" dialog when the user selects "No" from my Yes/No dialog during uninstall.
The uninstall gets aborted correctly, but why does MSI pop up the "fatal error" dialog? How do I suppress this dialog?

03-30-2004, 04:05 AM
I know that I had the very same fatal error message but that I don't now.
My custom action is type 6 ( a .vbs file stored in the binary table). The target of the custom action is the function name. I wait for execution to finish and I don't ignore the return value - immediate execution and always execute. Note the location of the custom action is at the beginning of the execute sequence between launchconditions and findreleatedproducts. My vbscript code looks something like this.

Function RemovalWarning()
Const CANCEL = 2

If Condition Then
MyRet = MsgBox ("Are you sure you want to uninstall this product ", 1, "Removal Warning")
If MyRet = 2 Then
End if
End if

I've just noticed that the return value that I'm using is 2 not 3 as I stated earlier - sorry for the confusion try return value of 2 and see can you avoid the fatal error message