bfuchs
asked on
Automating recognition of network drive
Hi Experts,
Due to a certain problem on our network, our IT guy instructed us to use the following in a batch file every time we restart the pc's,
However the folder does not get to accessible until we open the windows browser and double click on that mapped network drive (N:).
Now I wonder if there is a way to avoid that extra last step?
It could be either by adding something to the batch file, or perhaps adding some code in our Access FE application that would accomplish that.
FYI- Only Win7 users are required to run that batch & need to have this fixed, while Win XP users are not required, and the network drive is immediately recognized upon restart.
Due to a certain problem on our network, our IT guy instructed us to use the following in a batch file every time we restart the pc's,
@echo off
cls
cd \
route add XXX.XXX.1.XXX mask 255.255.255.255 XXX.2.1.1
pause
exit
this should make the folder on the server where our Access DB resides should be recognized However the folder does not get to accessible until we open the windows browser and double click on that mapped network drive (N:).
Now I wonder if there is a way to avoid that extra last step?
It could be either by adding something to the batch file, or perhaps adding some code in our Access FE application that would accomplish that.
FYI- Only Win7 users are required to run that batch & need to have this fixed, while Win XP users are not required, and the network drive is immediately recognized upon restart.
ASKER
@Dany,
The first thing I get when adding your line is msg attached as untitleld.pgn
then I changed to the name already mapped (wgcts\data) and got second message attached as untitleld1.pgn
Thanks,
Ben
Untitled.png
Untitled1.png
The first thing I get when adding your line is msg attached as untitleld.pgn
then I changed to the name already mapped (wgcts\data) and got second message attached as untitleld1.pgn
Thanks,
Ben
Untitled.png
Untitled1.png
You should let it run on start! The batch should run once!
ASKER
I did execute the batch the first thing after restart.
Do you mean it must be run as startup?
Do you mean it must be run as startup?
Not necessarily as long as it runs only once! Because you can only add the same route once! Then after the route is added.. The dir should do the trick! Also the net use command can only be run once for the same drive name.. So, u should disconnect the map drive first! Or instead of n: try the command with x: and see if it works.. Also replace the dir n: with dir x: and tell me if it works
ASKER
ok, I restarted pc, ran the following
Untitled.png
@echo off
cls
cd \
route add 999.999.1.999 mask 255.255.255.255 999.2.1.1
net use X: \\999.999.1.999\data /persistent:yes
pause
exit
and got the attachedUntitled.png
Ok just run the route add alone in the command line..
Then go to start > Run and type \\999.999.1.999\data and see if the folder opens! Also try to ping 999.999.1.999 once the route is done to verify that u don't have connectivity issues!
Then go to start > Run and type \\999.999.1.999\data and see if the folder opens! Also try to ping 999.999.1.999 once the route is done to verify that u don't have connectivity issues!
ASKER
Hi Dany,
I am little confused as to whats happening here...
before I started playing with this, all my network drives were accessible
however now none of them are..
Also I disconnected the N drive and wanted to re-mapped and I cant.
they are somehow connected as they show me the amount of disc space, but when I click on them, I get the error attached.
Perhaps I will have to call our IT guy first in order for us to proceed...
Thanks,
Ben
Untitled.png
I am little confused as to whats happening here...
before I started playing with this, all my network drives were accessible
however now none of them are..
Also I disconnected the N drive and wanted to re-mapped and I cant.
they are somehow connected as they show me the amount of disc space, but when I click on them, I get the error attached.
Perhaps I will have to call our IT guy first in order for us to proceed...
Thanks,
Ben
Untitled.png
ASKER
FYI,
Ok just run the route add alone in the command line..got message OK!
Also try to ping 999.999.1.999 once the route is donegetting back reply.
Then go to start > Run and type \\999.999.1.999\data and see if the folder opens!nope.
So u have a problem with the network share! Maybe u need a password.. Try this for instance:
net use z: \\servername\folder /persistent:yes /user:username password
net use z: \\servername\folder /persistent:yes /user:username password
Also try net use /delete * before any other command (warning: this will delete all existing connections to any network resources)
ASKER
Hi,
I am out of the office, our IT guy will check this tom & we will continue next week.
Have a nice weekend,
Ben
I am out of the office, our IT guy will check this tom & we will continue next week.
Have a nice weekend,
Ben
ASKER
Hi Dany,
I had installed a couple of software into that pc last week and It looks like they are causing this network problem...
However I tried both of your original suggestions in another win7 pc, and none of them seems to be doing the trick, in other words without user manually clicking on N drive, the app gives you an error that N drive is not connected..Any other suggestions?
Thanks,
Ben
I had installed a couple of software into that pc last week and It looks like they are causing this network problem...
However I tried both of your original suggestions in another win7 pc, and none of them seems to be doing the trick, in other words without user manually clicking on N drive, the app gives you an error that N drive is not connected..Any other suggestions?
Thanks,
Ben
Unmap the network drive, then let it map using my command from the batch file.. Then try also the following please.. After the mapping type:
N:
Will that work?
N:
Will that work?
ASKER
see attached
Untitled.png
Untitled.png
ASKER
btw, currently I restart the pc every time I want undo the route cmd, is there a command to do that instead?
Well I wasn't talking about the route cmd.. I was talking About the mapping thing!
To delete the route u just type: route delete xxx.xxx.1.xxx
To cancel the mapping u just type:
Net use /delete *
To delete the route u just type: route delete xxx.xxx.1.xxx
To cancel the mapping u just type:
Net use /delete *
Can u show me the list of commands typed in the batch file As they are, so i can analyze each error in ur screenshot?
ASKER
Hi,
this is the batch
this is the batch
@echo off
cls
cd \
route add 999.999.1.999 mask 255.255.255.255 999.2.1.1
net use N: \\999.999.1.999\data /persistent:yes
N:
dir n:\bbb
pause
exit
The network path was not found.. Means the mapping did not succeed.. As long as the share is not accessible, nothing will work after that!
ASKER
@Dany,
As originally stated, the batch w/o the additional line
As far I know, we already tested all the following:
adding that line
adding dir n:\bbb
just adding n:
unmapping and have the batch map the drive
net use z: \\servername\folder /persistent:yes /user:username password
replace the dir n: with dir x:
...
So let me know what else should we try to get that done..
Thanks,
Ben
As originally stated, the batch w/o the additional line
net use N: \\999.999.1.999\data /persistent:yes
works, the issue is just having to manually double click on the N drive in order to get that fully recorgnized by all programs.As far I know, we already tested all the following:
adding that line
adding dir n:\bbb
just adding n:
unmapping and have the batch map the drive
net use z: \\servername\folder /persistent:yes /user:username password
replace the dir n: with dir x:
...
So let me know what else should we try to get that done..
Thanks,
Ben
hello ben,
please try the following commands one after another in a command prompt window:
ping xxx.xxx.1.xxx
if ping gives you 4 successful pings, continue below!
net use k: \\xxx.xxx.1.xxx\your\netwo rk\share
the last message you should get is the following:
The command completed successfully.
if this succeeds then your network is ready.. we can go further
if you get the following message:
The network path was not found.
then, please verify the network path you just typed, it could be that you cannot access that specific path.
try to open the path using windows explorer, by typing: \\xxx.xxx.1.xxx\your\netwo rk\share into windows explorer and see what happens!
i just tried my script on my network with a network share outside of my subnet from both a windows xp pc and a windows 7 pc and both worked:
my ip address is: 10.254.177.11
this is the script i used:
and this is the result that i got:
C:\Documents and Settings\dandoon\Desktop>p ing 10.255.185.16
Pinging 10.255.185.16 with 32 bytes of data:
Reply from 10.255.185.16: bytes=32 time=36ms TTL=126
Reply from 10.255.185.16: bytes=32 time=35ms TTL=126
Reply from 10.255.185.16: bytes=32 time=48ms TTL=126
Reply from 10.255.185.16: bytes=32 time=32ms TTL=126
Ping statistics for 10.255.185.16:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 32ms, Maximum = 48ms, Average = 37ms
C:\Documents and Settings\dandoon\Desktop>n et use g: \\10.255.185.16\sharedfold er /user:mydomain\myuser mypassword /persistent:yes
The command completed successfully.
C:\Documents and Settings\dandoon\Desktop>d ir g:
Volume in drive G is Local Disk
Volume Serial Number is 907C-EB3C
Directory of G:\
31/10/2014 12:06 PM <DIR> .
31/10/2014 12:06 PM <DIR> ..
23/05/2014 11:42 AM 1,122,816 7z920 32 bit.msi
18/11/2010 10:03 PM 1,376,768 7z920-x64.msi
...
...
...
26 File(s) 83,967,554 bytes
4 Dir(s) 27,831,103,488 bytes free
C:\Documents and Settings\dandoon\Desktop>p ause
Press any key to continue . . .
One last remark.. if you use the net use command the path you use must not end with a backslash
net use x: \\xxx.xxx.1.xxx\my\share is correct
net use x: \\xxx.xxx.1.xxx\my\share\ is wrong
please try the following commands one after another in a command prompt window:
ping xxx.xxx.1.xxx
if ping gives you 4 successful pings, continue below!
net use k: \\xxx.xxx.1.xxx\your\netwo
the last message you should get is the following:
The command completed successfully.
if this succeeds then your network is ready.. we can go further
if you get the following message:
The network path was not found.
then, please verify the network path you just typed, it could be that you cannot access that specific path.
try to open the path using windows explorer, by typing: \\xxx.xxx.1.xxx\your\netwo
i just tried my script on my network with a network share outside of my subnet from both a windows xp pc and a windows 7 pc and both worked:
my ip address is: 10.254.177.11
this is the script i used:
ping 10.255.185.16
net use g: \\10.255.185.16\sharedfolder /user:mydomain\myuser mypassword /persistent:yes
dir g:
pause
and this is the result that i got:
C:\Documents and Settings\dandoon\Desktop>p
Pinging 10.255.185.16 with 32 bytes of data:
Reply from 10.255.185.16: bytes=32 time=36ms TTL=126
Reply from 10.255.185.16: bytes=32 time=35ms TTL=126
Reply from 10.255.185.16: bytes=32 time=48ms TTL=126
Reply from 10.255.185.16: bytes=32 time=32ms TTL=126
Ping statistics for 10.255.185.16:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 32ms, Maximum = 48ms, Average = 37ms
C:\Documents and Settings\dandoon\Desktop>n
The command completed successfully.
C:\Documents and Settings\dandoon\Desktop>d
Volume in drive G is Local Disk
Volume Serial Number is 907C-EB3C
Directory of G:\
31/10/2014 12:06 PM <DIR> .
31/10/2014 12:06 PM <DIR> ..
23/05/2014 11:42 AM 1,122,816 7z920 32 bit.msi
18/11/2010 10:03 PM 1,376,768 7z920-x64.msi
...
...
...
26 File(s) 83,967,554 bytes
4 Dir(s) 27,831,103,488 bytes free
C:\Documents and Settings\dandoon\Desktop>p
Press any key to continue . . .
One last remark.. if you use the net use command the path you use must not end with a backslash
net use x: \\xxx.xxx.1.xxx\my\share is correct
net use x: \\xxx.xxx.1.xxx\my\share\ is wrong
ASKER
@Dany,
I think I know what is the problem here...
When I run the commands as a batch I get the attached, however when I try execute each command separately from DOS prompt they do execute successfully...
Therefore I guess we need to put in some logic to wait a few seconds after the route command..
Let me know if this makes sense.
Thanks,
Ben
Untitled.png
I think I know what is the problem here...
When I run the commands as a batch I get the attached, however when I try execute each command separately from DOS prompt they do execute successfully...
Therefore I guess we need to put in some logic to wait a few seconds after the route command..
Let me know if this makes sense.
Thanks,
Ben
Untitled.png
just for testing purposes, add the commands after the pause!
then on startup the system will give you a press any key to continue..
wait for a few seconds and then press any key.. and see if that's the issue so i can tell you how to add a delay in the batch
then on startup the system will give you a press any key to continue..
wait for a few seconds and then press any key.. and see if that's the issue so i can tell you how to add a delay in the batch
ASKER
Hi Dany,
Out of the office, Will try next week when I am back.
Thanks,
Ben
Out of the office, Will try next week when I am back.
Thanks,
Ben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
So, add this line before the pause:
Open in new window
if you can't map it yourself because you don't have the password to that resource then i suggest the following hack:
add this after the pause:
Open in new window
this will try to display the listing of the N drive and search for a file called bbbbbb.. the result will be a File not found but it will be as if you double clicked on the network drive :)
hope this helps