Re: using VBAS login script



Here is the script I am using, but I am getting errors on login:

' Example of VBScript Mapping two drives in one script.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.6 - April 24th 2005
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, strRemotePath4, strRemotePath5
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4, strDriveLetter5

strDriveLetter1 = "H:"
strDriveLetter2 = "G:"
strDriveLetter3 = "S:"
strDriveLetter4 = "T:"
strDriveLetter5 = "U:"
strRemotePath1 = "\\server\Data"
strRemotePath2 = "\\server\users\%username%"
strRemotePath3 = "\\server\Shared"
strRemotePath4 = \\server\folder"
strRemotePath5 = \\server\folder2"

Set objNetwork = CreateObject("WScript.Network")

' Section which maps, H: G: S: T: and U:
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3
objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4
objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5

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

Wscript.Quit

' End of Windows Logon Script Example

.



Relevant Pages

  • Re: What is wrong with this login script
    ... The script engine will not read the environment variable ... Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, ... objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5 ...
    (microsoft.public.scripting.vbscript)
  • RE: Help with Login Script.
    ... If ComputerName = Server Then 'put Servername in double quotes ... Dim objNetwork, ComputerName ... Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, ... ' Purpose of the script to create a network object. ...
    (microsoft.public.windows.server.scripting)
  • Re: What is wrong with this login script
    ... The script engine will not read the environment variable for the user name. ... Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, ... objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5 ...
    (microsoft.public.scripting.vbscript)
  • Re: What is wrong with this login script
    ... take a look at this script and tell me why I would not run correctly. ... Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, ... objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5 ...
    (microsoft.public.scripting.vbscript)
  • What is wrong with this login script
    ... I just started to look at scripting and was hoping someone could take a look at this script and tell me why I would not run correctly. ... Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, ... objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5 ...
    (microsoft.public.scripting.vbscript)

Loading