/build/static/layout/Breadcrumb_cap_w.png

WSH from Wise for Windows Installer

I want to use Windows Script Host (WSH) from a VBScript called by a Wise install.
It seems that "Call VBScript from ..." does not have access to WSH.

The below VBScript fragment runs fine outside of Wise, but if called from the Wise install it fails.
If I step through with a debugger I get a "Variable is undefined 'WScript' " error
on the WScript.CreateObject call. (about line 9)

I am using Wise for Windows Installer 5.21 on WinXP SP2.
I am a very light Wise for Windows user and use it to deploy inhouse applications.

I have a hack/workaround that will work.
If I add my vbs file to the INSTALLDIR I can use "Execute Program from Destination"
to call wscript.exe/cscript.exe.
Setting the "working directory" to INSTALLDIR and
"EXE and command line" to "wscript.exe wise_test.vbs" works for this test script,
but is not the most intutive way to do it.

Am I doing something wrong or does Wise "hide" the WSH?


Thanks
Scott



Option Explicit
'On Error Resume Next

Dim objSysInfo
Dim NETcomp_name
Dim WshNetwork
Dim errnum

Set WshNetwork = WScript.CreateObject("WScript.Network")
MsgBox "Error num: " & Err.Number
NETcomp_name = WshNetwork.ComputerName & "," & WshNetwork.UserDomain
MsgBox "Error num: " & Err.Number
MsgBox "net name: " & NETcomp_name

MsgBox "CompName is: " & NETcomp_name

0 Comments   [ + ] Show comments

Answers (3)

Posted by: brenthunter2005 15 years ago
Fifth Degree Brown Belt
2
You cant use the Wscript object because it is already kinda defined.

Remove the "wscript." references from your script and all will be fine.
Posted by: srouse 15 years ago
Yellow Belt
0
ORIGINAL: brenthunter2005

You cant use the Wscript object because it is already kinda defined.

Remove the "wscript." references from your script and all will be fine.


Thanks,
That was easy.

Is this any of the help files? I looked and could not find anything.

Note to Wise Solutions Inc: Please add this to help file.

Thanks again

Scott
Posted by: brenthunter2005 15 years ago
Fifth Degree Brown Belt
0
I'm pretty sure I've seen this in the Windows Installer SDK documentation.
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