Link to home
Start Free TrialLog in
Avatar of Kenoboy
Kenoboy

asked on

mapped drives disappearing after reboot

we use logon vbs scripts to map multiple drives. everything works great when on the network. If user is off the network and reboots their computer the mapped drives disappear. now when they vpn into the network drive are gone. why is this happening?
Avatar of leonov_alex
leonov_alex
Flag of Russian Federation image

When you map disk say "persistent".

ex. net use s: \\server\share /persistent
Avatar of ggefter
ggefter

in theory, since im not a scripter and havnt seen your scripts, the drives need to mapped as persistanst so when the pc reboots, it attempts to map them again. This is not happening and the reason why they are not seeing there mappings when connecting to a vpn is because the login script runs when a user logs in and authenticates against the network. Since your already logged in when connecting to the vpn, the script does not execute.
You can put a copy of the script on the users desktop so once they vpn, then can run the script manually by double clicking it or you can go back into your script and set the drives to be persistant.

I believe the switch to do so is:
Survive reboot: net use /persistent:yes
so all you need to do is add "/persistent:yes" to the end of each line of mappings

I'd love for someone to correct me if im wrong though ...
Avatar of Kenoboy

ASKER

this is the script being used, can you use the /persistant if not using net use? I'm not really a scripter, just learning.
Option Explicit
Dim strDriveLetter, strRemotePath
Dim objNetwork, objShell
Dim CheckDrive, AlreadyConnected, intDrive 
' The section sets the variables. 
strDriveLetter = "T:" 
strRemotePath = "\\IN1DX01.atlpl.com\it docs" 

' 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() 

' 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) =strDriveLetter _
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 strDriveLetter 
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
 

' The first message box
'objShell.PopUp "Drive " & strDriveLetter & _
'"Disconnected, then connected successfully." 
Else
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath 
'objShell.PopUp "Drive " & strDriveLetter & _
'" connected successfully." 
End if 
WScript.Quit

Open in new window

thats alot of script for 1 drive lol ...
try just creating a .bat or a .vbs script that looks like this

net use T: \\IN1DX01.atlpl.com\it docs /persistent:yes

and test it to see if this is the result you want, after you save it you can just run it from your desktop instead of over the network.
ASKER CERTIFIED SOLUTION
Avatar of leonov_alex
leonov_alex
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kenoboy

ASKER

This worked perfect, can you explain what adding the 1 did? Thanks.