rahab
05-16-2002, 08:55 PM
I am using a simple VBScript as my login script to map network drives for users (server=NT4 client=W98). It works great. I would like to add to this script and have it call either a .bat file or a .exe file which will update virus definitions on the users machine. How do I get the script to call the other program and run it? The .bat file is located in the same NETLOGON share as the .vbs script and basically calls the .exe which is located on another server. The .bat file runs great by itself, I just cannot figure out how to call it from within the .vbs script.
Here is the script I am using:
dim WSHNetwork, WSHShell,FileSysObj
set WSHShell=Wscript.CreateObject("Wscript.Shell")
set WSHNetwork=Wscript.CreateObject("Wscript.Network")
set FileSysObj=Wscript.CreateObject("Scripting.FileSystemObject")
ON ERROR RESUME NEXT
wscript.echo "Computer - " & WSHNetwork.ComputerName
MapDrive "J:","\\server\share"
MapDrive "K:","\\server\share2"
WSHShell.popup "Network Logon Complete!",3,"Network Logon",0+64
set WSHShell=Null
set WSHNetwork=Null
set FileSysObj=Null
Wscript.quit
'***********************************************
' MapDrive '
'***********************************************
Function MapDrive(Drive,Share)
If FileSysObj.DriveExists(share)=True Then
wscript.echo "Verified " & share & " is available"
If FileSysObj.DriveExists(Drive)=True Then
wscript.echo "Removing previous connection to " & Drive
WSHNetwork.RemoveNetworkDrive Drive
End If
wscript.echo "Mapping " & Drive & " to " & Share
WSHNetwork.MapNetworkDrive Drive, Share
Else
WSHShell.Popup "COULD NOT VERIFY " & SHARE & "! CONTACT THE NETWORK ADMIN",10,"Drive Map Error",0+48
End If
End Function
Here is the script I am using:
dim WSHNetwork, WSHShell,FileSysObj
set WSHShell=Wscript.CreateObject("Wscript.Shell")
set WSHNetwork=Wscript.CreateObject("Wscript.Network")
set FileSysObj=Wscript.CreateObject("Scripting.FileSystemObject")
ON ERROR RESUME NEXT
wscript.echo "Computer - " & WSHNetwork.ComputerName
MapDrive "J:","\\server\share"
MapDrive "K:","\\server\share2"
WSHShell.popup "Network Logon Complete!",3,"Network Logon",0+64
set WSHShell=Null
set WSHNetwork=Null
set FileSysObj=Null
Wscript.quit
'***********************************************
' MapDrive '
'***********************************************
Function MapDrive(Drive,Share)
If FileSysObj.DriveExists(share)=True Then
wscript.echo "Verified " & share & " is available"
If FileSysObj.DriveExists(Drive)=True Then
wscript.echo "Removing previous connection to " & Drive
WSHNetwork.RemoveNetworkDrive Drive
End If
wscript.echo "Mapping " & Drive & " to " & Share
WSHNetwork.MapNetworkDrive Drive, Share
Else
WSHShell.Popup "COULD NOT VERIFY " & SHARE & "! CONTACT THE NETWORK ADMIN",10,"Drive Map Error",0+48
End If
End Function