Hi all,
Been playing with some logon scripts this afternoon to try an map a pre-defined set of network drives for our users.
I started with the NET USE command in a batch file and this worked with some success, but failed when i need to provide user credentials.
So i moved to a VBS script which also seems to work ok but i'm coming across some very strange quirks...
Firstly, the script only seems to work for any one who has mapped the network resource in the past. If i apply the script to a new user account (with no cached connections etc) it does not work. If i browse the resources in question and then run the script again the drives map fine.
Any idea what i'm doing wrong?
The script i'm using is:
Been playing with some logon scripts this afternoon to try an map a pre-defined set of network drives for our users.
I started with the NET USE command in a batch file and this worked with some success, but failed when i need to provide user credentials.
So i moved to a VBS script which also seems to work ok but i'm coming across some very strange quirks...
Firstly, the script only seems to work for any one who has mapped the network resource in the past. If i apply the script to a new user account (with no cached connections etc) it does not work. If i browse the resources in question and then run the script again the drives map fine.
Any idea what i'm doing wrong?
The script i'm using is:
' map-network-drive.vbs
' VBScript to map a network drive
' ----------------------------------------------------------------------'
Option Explicit
Dim objNetwork
Dim strDriveLetter1, strRemotePath1
Dim strDriveLetter2, strRemotePath2
' Values of variables set
strDriveLetter1 = "w:"
strRemotePath1 = "\\172.16.100.42\d$"
strDriveLetter2 = "T:"
strRemotePath2 = "\\172.16.100.52\d$"
Set objNetwork = WScript.CreateObject("WScript.Network")
' Part that maps the network drive
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2