mapped drives disappearing after reboot

Posted on 2010-03-31
Medium Priority
Last Modified: 2012-05-09
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?
Question by:Kenoboy
  • 3
  • 2
  • 2

Expert Comment

ID: 29227894
When you map disk say "persistent".

ex. net use s: \\server\share /persistent

Expert Comment

ID: 29228423
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 ...

Author Comment

ID: 29228796
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

' 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." 
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath 
'objShell.PopUp "Drive " & strDriveLetter & _
'" connected successfully." 
End if 

Open in new window

We Need Your Input!

WatchGuard is currently running a beta program for our new macOS Host Sensor for our Threat Detection and Response service. We're looking for more macOS users to help provide insight and feedback to help us make the product even better. Please sign up for our beta program today!


Expert Comment

ID: 29229608
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.

Accepted Solution

leonov_alex earned 500 total points
ID: 29229779
You have to use third bool argument in MapNetworkDrive:
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, 1(or true)

Author Closing Comment

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

Featured Post

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Web hosting control panels were first developed to make it faster and easier for most users to set up and operate websites. The graphical user interface (GUI) allows users to perform tasks by pointing and clicking rather than typing highly specific…
With more and more companies allowing their employees to work remotely, it begs the question: What are some of the security risks involved with remote employees and what actions should we take to secure them?
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question