PDA

View Full Version : basic network scripts????



aidanmaz
03-01-2006, 12:36 AM
server 2003

have multiple users who will connect to server, i want them to be able to have mapped drives upon logon

first drive D$\applications ($ cos its a logical drive) share name FS1
\\server\FS1

Second Drive D$\System files share name: FS2
\\server\FS2
server name: server
and printer is HP deskjet 840c share name HP (\\serve
r\HP)
i was reading MS website and the logon script area really confused me, i found this:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set AllDrives = WshNetwork.EnumNetworkDrives()
DriveLetter = "N:" 'must be capitalized
RemotePath = "\\dave\c"
AlreadyConnected = False
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter Then AlreadyConnected = True
Next
If AlreadyConnected = False then
WShNetwork.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp "Drive " & DriveLetter & " connected successfully."
Else
WShNetwork.RemoveNetworkDrive DriveLetter
WshShell.PopUp "Drive " & DriveLetter & " disconnected."
End if

but subsititing doesnt work.....any help????

kingdragonfly
03-01-2006, 10:04 AM
That is a weird script. It's enumerating every other drive: "For i = 0 To AllDrives.Count - 1 Step 2"

If you just want to map network drives, just use a CMD or BAT file, and the "NET USE" command

Start run...CMD
NET USE /? [help]
NET USE [display all map drives]
NET USE X: /DELETE
NET USE X: \\SERVER\FS1 /PERSISTENT:YES