Yes it is Windows 2003, and i have it placed on a server that i can report too. Here is the script below:
"Option Explicit
Dim objShell, objNetwork,DriveLetter,RemotePath, UserName, ApptoRun, FSO
Dim DriveLetter1, DriveLetter2, DriveLetter3,RemotePath1, RemotePath2, RemotePath3
Dim AllDrives, AlreadyConnected, Network1, Network2,Network3, i
'Here I indicate what drive letters to use
DriveLetter1 = "R:" ' This letter must be in CAPITALS.
DriveLetter2 = "P:"
DriveLetter3 = "W:"
DriveLetter = "H:" 'this is user home dir
'Here is the path to use for the drives
RemotePath = "\\IMISVR4\DNI"
RemotePath1 = "\\IMISVR4\DNI"
RemotePath2 = "\\IMISVR4\DNI"
RemotePath3 = "\\IMISVR4\DNI"
Set Network1 = CreateObject("WScript.Network")
Set Network2 = CreateObject("WScript.Network")
Set Network3 = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set AllDrives = objNetwork.EnumNetworkDrives()
AlreadyConnected = False
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter Then AlreadyConnected = True
Next
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter
'all objshell.Popup lines can be commented out, they are mainly for testing
'objShell.PopUp "Drive " & DriveLetter & " disconnected."
'if commenting out objshell.Popup comment out the Else also
Else
'objShell.PopUp "Drive " & DriveLetter & " no initial connection"
End if
'this is a commented out line Here is where we extract the UserName
UserName = objNetwork.UserName
'this is a commented out line objNetwork.MapNetworkDrive DriveLetter, RemotePath & "\" & UserName
'objShell.PopUp "Drive " & DriveLetter & " connected successfully."
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter1 Then AlreadyConnected = True
Next
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter1
'objShell.PopUp "Drive " & DriveLetter1 & " disconnected."
Else
'objShell.PopUp "Drive " & DriveLetter1 & " no initial connection"
End if
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
'objShell.PopUp "Drive " & DriveLetter1 & " connected successfully."
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter2 Then AlreadyConnected = True
Next
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter2
'objShell.PopUp "Drive " & DriveLetter2 & " disconnected."
Else
'objShell.PopUp "Drive " & DriveLetter2 & " no initial connection"
End if
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
'objShell.PopUp "Drive " & DriveLetter2 & " connected successfully."
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter3 Then AlreadyConnected = True
Next
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter3
'objShell.PopUp "Drive " & DriveLetter2 & " disconnected."
Else
'objShell.PopUp "Drive " & DriveLetter3 & " no initial connection"
End if
objNetwork.MapNetworkDrive DriveLetter3, RemotePath3
'objShell.PopUp "Drive " & DriveLetter3 & " connected successfully."
'This section runs the Deski workstation client
AppToRun = "P:\invclient.EXE" 'path to where your Deski client files are
Set FSO = CreateObject("Scripting.FileSystemObject")
CreateObject("Wscript.Shell").Run AppToRun
WScript.Quit
' End of Script"