VBScript will not execute correctly from MSI file

setup-project, vbscript, windows-installer

Solution

In the "shell" sub, I removed the WScript from the first line before the call to "CreateObject()". The amended line now looks like this:

'Note the absent reference to WScript on the call to CreateObject()
Set objShell = CreateObject("WScript.Shell")

Problem

I have a VBScript I wrote that needs to be executed from an MSI file. The script correctly executes when I run it within Windows on its own, however, when I run it from the installer I get the following error as shown in the log file: ``` Microsoft VBScript runtime error: object required: 'WScript', Line 3, Column 2 ``` The script is below: ``` sub shell(cmd) Set objShell = WScript.CreateObject("WScript.Shell") objShell.Run("""" & cmd & """") Set objShell = Nothing end sub set objFSO = CreateObject("Scripting.FileSystemObject") strcmd32 = "C:\Path\PathToExecutable.exe" strcmd64 = "C:\Path\PathToExecutable64.exe" if (objFSO.FileExists(strcmd32)) then shell(strcmd32) else shell(strcmd64) end if set objFSO = Nothing ``` As stated before, this script runs fine if I run it outside the context of the installer. The setup project type is VS2010 Setup and Deployment Package (this is what the client wishes to use and I cannot use anything else). Any ideas?

Original source