How to debug a .VBS custom action

Although using a Visual Basic script (.VBS) custom action is not a recommended approach, there are some times when scripting is a much quicker solution.

Tip The correct way to develop installer custom actions is through C++ .DLLs.

To avoid any installation errors resulting from a .VBS custom action you can use the information from this article to debug it line by line.

Here's what you need to do:

  1. Download and install Microsoft Script Debugger for Windows.
  2. Enable the Just In Time Debugging policy
  3. Make sure the custom action you are about to debug has a stopping point like a MsgBox occurrence. For example, the message can be "Starting Debug Mode...".
  4. Run the installer and after the custom action stops, launch "Msscrdbg.exe" from the debugger's install location.
  5. Attach the installer process(msiexec.exe) by accessing the debugger's bar menu > "View" > "Running Documents".
  6. Use the debugger's functionality to verify every line of code in your .VBS.