Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I execute more than 1 .vbs file from an .wsh file??? 1

Status
Not open for further replies.

slowalkaway

IS-IT--Management
Feb 16, 2005
6
US
Can I execute more than 1 .vbs file from an .wsh file???
Or is there some sort of include within a .vbs file where i can call another .vbs from within a .vbs???
 
Sure. How depends on exactly what you are attempting to do.

Could you explain exactly what you are wanting to do?
 
Ok.

First of all Im executing my logon scripts with a .wsh file which looks like this::
########################
[ScriptFile]
Path=pathtomylogonscript.vbs
[Options]
Timeout=5
DisplayLogo=1
BatchMode=0
########################
Ok, next my logon scirpt looks like this::

########################
Option Explicit
On Error Resume Next
Dim objNetwork, dLetter1, dLetter2, dLetter3, dLetter4, dLetter5,_
nPath1, nPath2, nPath3, nPath4, nPath5

Set objNetwork = CreateObject("WScript.Network")

'Drive letter variables
dLetter1 = "P:"
dLetter2 = "Q:"
dLetter3 = "R:"
dLetter4 = "N:"
dLetter5 = "V:"

'Network path variables
nPath1 = "somepath"
nPath2 = "somepath"
nPath3 = "somepath"
nPath4 = "somepath"
nPath5 = "somepath"

'Remove any mappings that may be present
objNetwork.RemoveNetworkDrive dLetter1
objNetwork.RemoveNetworkDrive dLetter2
objNetwork.RemoveNetworkDrive dLetter3
objNetwork.RemoveNetworkDrive dLetter4
objNetwork.RemoveNetworkDrive dLetter5
'Map network drives
objNetwork.MapNetworkDrive dLetter1, nPath1
objNetwork.MapNetworkDrive dLetter2, nPath2
objNetwork.MapNetworkDrive dLetter3, nPath3
objNetwork.MapNetworkDrive dLetter4, nPath4
objNetwork.MapNetworkDrive dLetter5, nPath5

WScript.Quit
##########################################

Ok, this all works very well.. Now I have a registry entry that I need to change on about one hundred computers.

This is in a seperate .vbs file and works perfectly. What I want to do is some how include it in my logon script, but just by say calling it. I want to keep all the code in a separte file so I can just comment it out in my logon script when Im done.
 
Ok.

First of all Im executing my logon scripts with a .wsh file which looks like this::

########################
Code:
[ScriptFile]
Path=pathtomylogonscript.vbs
[Options]
Timeout=5
DisplayLogo=1
BatchMode=0
########################

Ok, next my logon scirpt looks like this::

########################
Code:
Option Explicit
On Error Resume Next
Dim objNetwork, dLetter1, dLetter2, dLetter3, dLetter4, dLetter5,_
nPath1, nPath2, nPath3, nPath4, nPath5

Set objNetwork = CreateObject("WScript.Network")

'Drive letter variables
dLetter1 = "P:"
dLetter2 = "Q:"
dLetter3 = "R:"
dLetter4 = "N:"
dLetter5 = "V:"

'Network path variables
nPath1 = "somepath" 
nPath2 = "somepath" 
nPath3 = "somepath"
nPath4 = "somepath"
nPath5 = "somepath"

'Remove any mappings that may be present
objNetwork.RemoveNetworkDrive dLetter1
objNetwork.RemoveNetworkDrive dLetter2
objNetwork.RemoveNetworkDrive dLetter3
objNetwork.RemoveNetworkDrive dLetter4
objNetwork.RemoveNetworkDrive dLetter5
'Map network drives
objNetwork.MapNetworkDrive dLetter1, nPath1
objNetwork.MapNetworkDrive dLetter2, nPath2
objNetwork.MapNetworkDrive dLetter3, nPath3
objNetwork.MapNetworkDrive dLetter4, nPath4              
objNetwork.MapNetworkDrive dLetter5, nPath5

WScript.Quit
##########################################

Ok, this all works very well.. Now I have a registry entry that I need to change on about one hundred computers.

This is in a seperate .vbs file and works perfectly. What I want to do is some how include it in my logon script, but just by say calling it. I want to keep all the code in a separte file so I can just comment it out in my logon script when Im done.
 
You should be able to use either the Run Method ( or the Exec Method ( to do what you are looking for, depending on how much control you want over the actual execution of the other script.

But, as I said the my other prost relating to this, you're better served using the GPO to make the change to that specific registry value.
 
Thanks, Im going to check this out, and with the GPO method, I take it this is something I can do from within the script? Sorry, im a Newbie.
 
GPO, or Group Policy Object, is accessed through Active Directory Users & Computers. Since you are talking about logon scripts and such I'm assuming you have a Windows 2000/2003 domain.

In ADU&C you can right click on the domain at the top, select properties, go to the Group Policy tab, and edit the Default Domain policy. From within there you can make the apropriate changes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top