you doing login scripts for a domain in group policy?
if so, you'll need to save this as a .vbs and set it as the logon script:
Option Explicit
Dim strDriveLetter1, strRemotePath1
Dim strDriveLetter2, strRemotePath2
Dim objNetwork, objShell
Dim CheckDrive, AlreadyConnected, intDrive
' This sections creates two objects:
' objShell and objNetwork and counts the drives
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set CheckDrive = objNetwork.EnumNetworkDrives()
' The section sets the variables.
strDriveLetter1 = "Y:"
strDriveLetter2 = "Z:"
strRemotePath1 = "\\SERVER\FOLDER\" & objNetwork.UserName
strRemotePath2 = "\\SERVER\FOLDER"
' This section deals with a For ... Next loop
' See how it compares the enumerated drive letters
' with strDriveLetter
On Error Resume Next
AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) =strDriveLetter1 _
Then AlreadyConnected =True
Next
' This section uses the If = then, else logic
' This tests to see if the Drive is already mapped.
' If yes then disconnects
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive strDriveLetter1
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
' The first message box
objShell.PopUp "Drive " & strDriveLetter1 & _
"Disconnected, then connected successfully."
Else
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objShell.PopUp "Drive " & strDriveLetter1 & _
" connected successfully." End if
' This section deals with a For ... Next loop
' See how it compares the enumerated drive letters
' with strDriveLetter
On Error Resume Next
AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) =strDriveLetter2 _
Then AlreadyConnected =True
Next
' This section uses the If = then, else logic
' This tests to see if the Drive is already mapped.
' If yes then disconnects
If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive strDriveLetter2
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
' The first message box
objShell.PopUp "Drive " & strDriveLetter2 & _
"Disconnected, then connected successfully."
Else
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objShell.PopUp "Drive " & strDriveLetter2 & _
" connected successfully." End if
WScript.Quit