Click to See Complete Forum and Search --> : Install error Custom Action VBS


srosenth
July 2nd, 2003, 11:01 AM
Created a setup project using VS.NET (2002). Added Custom Action to invoke a VBS that starts with the following:

Set wshell = WScript.CreateObject("WScript.Shell")
Set wargv = WScript.Arguments

The VBS runs just fine when invoked from Windows. However, when running the resulting MSI, I receive the following:

MSI (s) (E8:EC): Product: MyProd -- Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action _7E1305B0_BE3B_4D80_8D14_E080DB8F2C24 script error -2146827864, Microsoft VBScript runtime error: Object required: 'WScript' Line 1, Column 1,

This occurs on any reference through "WScript". That is, I can get around the error by changing the first line to:

Set wshell = CreateObject("WScript.Shell")

but then the problem just reoccurs when I try to reference the Arguments property (which has no work-around).

The fact that I can run this VBS from Windows suggests that the problem is either in the creation or invocation of the MSI.

Any suggestions or insights?

danoli
September 24th, 2003, 09:13 PM
I'm getting the exact same thing... I guess we just can't use WScript from within Custom Actions...
What did you do as a workaround?

srosenth
September 25th, 2003, 08:19 AM
I don't have a work-around.

Jazzynupe
December 4th, 2003, 03:19 PM
Thanks for the pointers. That was my exact problem trying to create icons on the desktop.

Now I can also reboot the PC with the script I believe. In terms of your issues with the arguments, maybe since this is not a "tratitional" shell script, you can't use arguments. what are you exactly trying to get from the arguments?

barsh
October 15th, 2004, 12:53 PM
I had the same problem but found a fix.

Here is how:

Change:
Set wshell = WScript.CreateObject("WScript.Shell")

To:
Set wshell = CreateObject("WScript.Shell")

Here is why:

The installer runs script custom actions directly and does not use the Windows Script Host. The WScript object cannot be used inside a script custom action because this object is provided by the Windows Script Host. Objects in the Windows Script Host object model can only be used in custom actions if Windows Script Host is installed on the computer by creating new instances of the object, with a call to CreateObject, and providing the ProgId of the object (for example "WScript.Shell"). Depending on the type of script custom action, access to some objects and methods of the Windows Script Host object model may be denied for security reasons.

For More Info:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/scripts.asp