/build/static/layout/Breadcrumb_cap_w.png

VBScript and custom actions - HELP

I am using Wise PS 3.2. I have created a custom (vbscript with embedded code, normal execute immeadiate/deferred, 1 step before scheduled reboot, deferred execution - system context, synchronous processing) with the following coding

Set objShell = WScript.CreateObject("WScript.Shell")
Set objEnvVar = objShell.Environment("PROCESS")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(objEnvVar("ProgramFiles") & "\Reuters\ipcroute",True)

objfile.WriteLine("#triarch_sink.sinklib:<localHostName>:<SinkDistributor>")
objfile.WriteLine("triarch_sink.sinklib:"& objEnvVar("COMPUTERNAME") & ":dist1 dist2")
objfile.WriteLine("triarch_dbms.srclib:"& objEnvVar("COMPUTERNAME") & ":src1 src2")
objFile.Close

This creates a file and populates it with the computer name of the machine the msi is being run on.

Whenever I compile this and try installing I get an internal error 2762.

CAn you help??

0 Comments   [ + ] Show comments

Answers (7)

Posted by: wiseapp 19 years ago
Second Degree Green Belt
2
Hi All:

The reason behind why you cannot use wscript.createobject coz MSI custom actions do not believe in instance creation at runtime and its not with Wscript.Createobject its with almost everything if you try to create any object at the runtime.
Posted by: brenthunter2005 19 years ago
Fifth Degree Brown Belt
0
Hello LawrenceTucker,

The error you are receiving is because you have set the Custom Action to "deferred execution - system context", yet placed the action outside of the required sequence (which exists from InstallInitalize and InstallFinalize).

Move the custom action so that it is before InstallFinalize.
Posted by: LawrenceTucker 19 years ago
Yellow Belt
0
Sorry the actual error code is 1720.
The action does lie between installinitialize and and installfinalize.

Any other ideas??
Posted by: artiahc_elay 19 years ago
Senior Yellow Belt
0
Set objShell = WScript.CreateObject("WScript.Shell")

delete WScript just use Set objShell = CreateObject("WScript.Shell")
Posted by: brenthunter2005 19 years ago
Fifth Degree Brown Belt
0
OK, error code 1720 means there is a problem with your script.

I've looked at your script at the top of this page, and see the command line:

Set objShell = WScript.CreateObject("WScript.Shell")

Change this line so that it reads:

Set objShell = CreateObject("WScript.Shell")

(You can't use that syntax within MSI custom actions. I don't know why not, but I just know you can't. If anyone knows the reasoning behind this, please let us know! [8D] )
Posted by: LawrenceTucker 19 years ago
Yellow Belt
0
Funniliy enough I tried that and it worked......... I was just coming back to post the solution and saw that two people provided me with an answer. Thanks anyway.
Posted by: MSIPackager 19 years ago
3rd Degree Black Belt
0
If anyone knows the reasoning behind this, please let us know

"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."

Clear as mud [:D]

Cheers,
Rob.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ