• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 727
  • Last Modified:

Referencing external scripts in VB6 (similar to hta)

Apologies for the title, let me explain:
I am designing a slightly prettier front-end naming system for WinPE/SCCM. I am looking at doing this in VB6.  The script I am recreating is attached. What I would like to know is how I reference "X:\ZTIUtility.vbs" as below within VB6? Without reference to this script, the environment vars aren't passed during the build.
Thank you
<job id="ZTIPromptForComputerName">
   <script language="VBScript" src="X:\ZTIUtility.vbs"/>
   <script language="VBScript">
Option Explicit
 
Dim numCount
Dim strComputerName
Dim strComputerOU
Dim objOSD
 
Do While numCount = 0
    strComputerName = InputBox ("Please enter a name for the new computer:","New Computer Name","",10,10)
    If strComputerName = "" Then
        Wscript.Echo "You must enter a computer name."
    Else
        oEnvironment.Item("OSDNEWMACHINENAME") = strComputerName
        oEnvironment.Item("OSDCOMPUTERNAME") = strComputerName
        Exit Do
    End If
 
Loop
 
Do While numCount = 0
    strComputerOU = InputBox ("Please enter OU for the new computer:","COMPUTER OU","",10,10)
    If strComputerOU = "" Then
        Wscript.Echo "You must enter an OU name."
    Else
        oEnvironment.Item("MACHINEOBJECTOU") = "OU=" & strComputerOU & ",OU=CaroeCourt Computers,DC=CaroeCourt,DC=Net"
	oEnvironment.Item("OSDDomainOUName") = "OU=" & strComputerOU & ",OU=CaroeCourt Computers,DC=CaroeCourt,DC=Net"
	oEnvironment.Item("OSDJoinDomainOUName") = "OU=" & strComputerOU & ",OU=CaroeCourt Computers,DC=CaroeCourt,DC=Net"
        Exit Do
    End If
Loop
   </script>
</job>

Open in new window

0
NewsInternationalLtd
Asked:
NewsInternationalLtd
  • 2
  • 2
1 Solution
 
jjardineCommented:
Have a look at this article http://www.vb-helper.com/howto_execute_vbscript.html    it might give some help towards the MSScriptcontrol
0
 
NewsInternationalLtdAuthor Commented:
Still not clear on this.
Should I add the vbscript as an object?
0
 
jjardineCommented:
I believe that you would instantiate the msscriptcontrol object and then add the vbscript text into that control to be able to execute it.  I do not know if you will be able to pull variables and the like into your vb6 program.  this just allows running vbs scripts.  
0
 
NewsInternationalLtdAuthor Commented:
I have re-written this as an HTA which now works fine. I don't think WinPE works properly with vb6.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now