mapped drive not connecting at logon, Windows 8.1

Pants

Active Member
Reaction score
21
Location
California, United States
I'll map a drive on my client's computer so Quickbooks can access it, but when the computer is restarted the mapped drive won't reconnect.


Some things I'm going to try (that I've searched for) are:

Enabling the local security policy rule: "Always wait for the network at computer startup and logon"

I thought about hard wiring the computer instead of using wifi (maybe ethernet NIC drivers won't take so long to load).

Deleting the drive and remapping it reestablishes the connection, but of course I don't want the guy to have to do this every time he logs on.

I asked the guy to leave his computer on and not restart it 'til I can come up with a permanent fix.

Any other suggestions?
 
Last edited:
Windows has a habit of attempting to reattach mapped drives before the network connection has been re-established. I always use a batch script for that reason:

(Replace router IP with a local router or server IP)

Code:
@echo off


SET ROUTER=192.168.0.1


:: Wait for the LAN connection to be established
:checknet
Ping %ROUTER% -n 1 -w 1000 >nul
if errorlevel 1 (
    goto :checknet
)

:: Delete all existing network connections
net use * /delete /yes

:: Remount network folders
:: Eg - net use z: "\\SERVER_IP\Shared" /user:username password /persistent:no
 
Yep, that's what I do as well. Usually in the All Users Startup folder
Same here. Or occasionally I add it as a logon/logoff script via gpedit.


To prevent the ugliness of the cmd window popup, I usually put a shortcut to the batch file in the Startup folder (instead of the file itself), then edit the shortcut's properties to run the batch file minimised.

Or, for complete stealth-mode, this is my preferred method:

Create a shortcut to:
Code:
%windir%\system32\wscript.exe "invisible.vbs" "netlogon.cmd"

... where netlogon.cmd is the batch file and invisible.vbs contains this:
Code:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
 
Question if you click on the drive letter anyway does it go ahead and connect? I've seen the popup on some systems that report unable to connect drives but they go ahead and do so when you try and access them from Windows Explorer.
Thanks. Never used a batch script before, as far as I can remember. I'd like to avoid using it if possible, but in case I do use it, regarding the "SET ROUTER=192.168.0.1" argument...

Does this need to be set to my client's specific default gateway? So if my client's default gateway is 192.168.1.1, should I use that instead of 0.1 ? I don't understand what's going on in the batch script.

Yes. It pings the router to see if you have your internet up yet. Once the ping is successful it maps the drives. Otherwise it loops back and tries to ping again.
 
Question if you click on the drive letter anyway does it go ahead and connect? I've seen the popup on some systems that report unable to connect drives but they go ahead and do so when you try and access them from Windows Explorer.


Yes. It pings the router to see if you have your internet up yet. Once the ping is successful it maps the drives. Otherwise it loops back and tries to ping again.

Thx. Yah I just realized that before I deleted the question, but you beat me.


If I right click on the drive (while it's disconnected) I see no option to "open" it. So double clicking on it probably wouldn't let me try to connect it.
 
Thx. Yah I just realized that before I deleted the question, but you beat me.


If I right click on the drive (while it's disconnected) I see no option to "open" it. So double clicking on it probably wouldn't let me try to connect it.

Without the script, when you start up you usually see the drive as disconnected (red X) if you immediately go to the Computer window. However if you double click on it should reload it if there are no problems with the networking. As Moultuea mentioned Windows tries to connect the drive before the network is completely up. This seem be be more of an issue with wireless connections as well.
 
I'm glad I tested out this script before I went onsite and tried it. I couldn't figure out what the "::" and the ":" was for. I get it now. I was going to run the script as it was and I couldn't figure out what I was doing wrong...Like I said, I am NOT use to using batch scripts. :eek:

But I got it to run during start up and it created the mapped drive. Thanks for sharing this awesome info
 
As you've probably figured out, the '::' (double colon) simply denotes comments and tells the command-line interpreter to 'skip this line'. It can be used interchangeably with 'Rem' (Remark), but I usually use the double colon; I think it just looks neater and makes comments easier to distinguish.

A ':' (single colon) denotes a label, to define a point to jump to or 'goto' ... a bit like how line numbers were used in early, first-generation BASIC.

Another point worth explaining is the use of the '/persistent:no' argument. This has the same effect as the GUI checkbox 'Reconnect at logon'. It's not strictly speaking required, since the 'no' state is implied if the argument is omitted, but I prefer to explicitly declare it to make sure it remains nonpersistent. It might seem that persistence should be 'yes', since you want the drive to be remapped at login, but this will cause Windows to attempt remapping before your script does, which will still work, but you may see the annoying "could not reconnect all network drives" notification as a result.
 
The script worked beautifully. It only took me a sec. to add in the right credentials, add it to the startup folder, and restart the computer. There's a bit of a delay loading the mapped drive, but I let the guy know to wait a few moment 'til accessing quickbooks.
 
Back
Top