Re: What script engine/version is used when executing VBScript custom action?

  • Thread starter Thread starter Eleanor
  • Start date Start date
E

Eleanor

rather than using
WScript.CreateObject("WScript.Shell")
use
CreateObject("WScript.Shell").


I have been googling the web/newsgroups on an error I am having to no
success. It seems that a VBScript that works fine outside of MSI VBScript
custom action would work fine, but fail in the MSI with strange
errors/problems:

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 FixXLSReg script
error -2146828283, : Line 165, Column 4,
MSI (s) (FC:6C): Product: CallCSH -- 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 FixXLSReg script err
or -2146828283, Microsoft VBScript runtime error: Invalid procedure call or
argument: 'arVNames.EnumValues' Line 165, Column 4,

When I run the script through debugger (via Wise/Visual Studio for script
debugging), I get weird problems. For example, in the function
getOpenSequencesFromReg, I can not iterate through objReg's objReg.Methods_.
I have tried to make the objReg global. Then I could iterate through the
methods. Even though when I iterate through the methods, I could see
"EnumValues" method, the script still generate the invalid procedure call or
argument error. But this seems to be working perfectly fine when executed
through CScript outside of MSI.

I have tried putting the VBScript in Immediate Execution, or Deferred
Execution, and in various positions; using elevated privs; playing with the
GetObject line. Nothing works. Only time I got it to work is by calling
CScript.exe to execute the script directly. So, I am assuming it is not a
security priviledge issue since the script executed properly via CScript.

The only conclusion that I could draw is that in MSI, the scripts are
executed using a different script engine/method? Any similar problems that
I have seen in the newsgroup seems to have the same solution/workaround of
"rewrite the custom action in a DLL, and call the DLL". Any other
ideas/fixes?
 
Hello Eleanor,

Not sure if you meant that I should use WScript.CreateObject to get the
WMI:StdRegProv? I tried to use WScript.GetObject() instead of GetObject()
once, but got a NULL error. Other than that, I don't have any CreateObject
call in my script at all.

Thanks,
Howard
 
WScript.quit ?


Hello Eleanor,

Not sure if you meant that I should use WScript.CreateObject to get the
WMI:StdRegProv? I tried to use WScript.GetObject() instead of GetObject()
once, but got a NULL error. Other than that, I don't have any CreateObject
call in my script at all.

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

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.



WScript.quit ?


Hello Eleanor,

Not sure if you meant that I should use WScript.CreateObject to get the
WMI:StdRegProv? I tried to use WScript.GetObject() instead of GetObject()
once, but got a NULL error. Other than that, I don't have any CreateObject
call in my script at all.

Thanks,
Howard
 
Back
Top