Export (0) Print
Expand All
4 out of 5 rated this helpful - Rate this topic

Return Values of JScript and VBScript Custom Actions

Custom actions written in JScript or Visual Basic, Scripting Edition (VBScript) can call an optional function. These functions must return one of the values shown in the following table.

Return valueValueDescription
msiDoActionStatusNoAction0Action not executed.
msiDoActionStatusSuccessIDOK = 1Action completed successfully.
msiDoActionStatusUserExitIDCANCEL = 2Premature termination by user.
msiDoActionStatusFailureIDABORT = 3Unrecoverable error. Returned if there is an error during parsing or execution of the JScript or VBScript.
msiDoActionStatusSuspendIDRETRY = 4Suspended sequence to be resumed later.
msiDoActionStatusFinishedIDIGNORE = 5Skip remaining actions. Not an error.

 

Note that Windows Installer translates the return values from all actions when it writes the return value into the log file. For example, if the action return value appears as 1 (one) in the log file, this means that the action returned msiDoActionStatusSuccess. For more information about this translation see Logging of Action Return Values.

To return a value other than success from a script custom action, you must use a function target for the custom action. The target function is specified in the Target column of the CustomAction Table.

The following script example shows you how to return success or failure from a VBScript custom action.

Function MyVBScriptCA()

    If Session.Property("CustomErrorStatus") <> "0" Then
        'return error
        MyVBScriptCA = 3
        Exit Function
    End If

    ' return success
    MyVBScriptCA = 1
    Exit Function

End Function

If this VBScript were embedded in the Binary table of the installation package as MyCA.vbs, the CustomAction Table entry for the script would be the following:

ActionTypeSourceTarget
MyCustomAction6MyCA.vbsMyVBScriptCA

 

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.