Logon Script to map drives/printers then run a .exe file.....error occurs

  • Thread starter Thread starter arnold.carl
  • Start date Start date
A

arnold.carl

' Windows Logon Script.
' VBScript - Just Map the two Fidelio Drives
' Author ' Version 1.0 2/26/07
' ----------------------------------------------------------'


' TwoMap.vbs - Map Network Drive to M: and P: and S:
' Example of VBScript Mapping two drives in one script.
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2
Dim strDriveLetter1, strDriveLetter2


strDriveLetter1 = "K:"
strDriveLetter2 = "U:"
strRemotePath1 = "\\server\share1"
strRemotePath2 = "\\server\share2"
Set objNetwork = CreateObject("WScript.Network")


' Section which maps two drives for fidelio and the common drive
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2


' Extra code just to add a message box
'WScript.Echo "Map drives " & strDriveLetter1 & " & " &
strDriveLetter2


'section to RUN VERSION Control
Set objShell = CreateObject("WScript.Shell")
objShell.Run "K:\path1\path2\version.exe"


'Wscript.Quit


' End of Windows Logon Script Example


The exe file won't run and gives this error message
Error is Variable is undefine:'obsShell'
I'm sure this is something simple but i'm kinda new to this
 
' Windows Logon Script.
' VBScript - Just Map the two Fidelio Drives
' Author ' Version 1.0 2/26/07
' ----------------------------------------------------------'


' TwoMap.vbs - Map Network Drive to M: and P: and S:
' Example of VBScript Mapping two drives in one script.
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2
Dim strDriveLetter1, strDriveLetter2


strDriveLetter1 = "K:"
strDriveLetter2 = "U:"
strRemotePath1 = "\\server\share1"
strRemotePath2 = "\\server\share2"
Set objNetwork = CreateObject("WScript.Network")


' Section which maps two drives for fidelio and the common drive
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2


' Extra code just to add a message box
'WScript.Echo "Map drives " & strDriveLetter1 & " & " &
strDriveLetter2


'section to RUN VERSION Control
Set objShell = CreateObject("WScript.Shell")
objShell.Run "K:\path1\path2\version.exe"


'Wscript.Quit


' End of Windows Logon Script Example


The exe file won't run and gives this error message
Error is Variable is undefine:'obsShell'
I'm sure this is something simple but i'm kinda new to this

All of that can be done with a simple 5 line batch file. Talk about
making things overly complicated for nothing...

John
 
error message
Error is Variable is undefine:'obsShell'

You simply forgot to declare the variable. When you use "Option
Explicit" (which is a very good idea), all variables must be declared
before they can be used.
I'm sure this is something simple but i'm kinda new to this

You were right.
 
Back
Top