Link to home
Start Free TrialLog in
Avatar of regsamp
regsamp

asked on

Adding a delay to drive connections

On a Windows XP Pro laptop that has remote access to an organization's network, the mapped drives try to connect to the network before the wireless connection is established and they error out as disconnected and we have to reconnect them after the network connection is established.  Is there a way in the registry or another means to add some kind of delay so that the drives will attempt to connect say 60 seconds later then they are now or can someone give an example of a loginscript.bat that can be placed in startup to cause a delay of the mapped drives?  Any assistance offered would be greatly appreciated.
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

You could use PING command to enter a delay, e.g.

ping 1.1.1.1 -w 60000 -n 1

would give a 60 second delay as long as host 1.1.1.1 times out.  If a router reports not reachable then try a real host the other side of the wireless LAN because then it will wait 60 secs if not connected to wireless or carry on straight away if you are.

hth

Steve
Or you could do something like this:

REM wait 60 secs if no ping response from server
ping server -w 60000 -n 1
:retry

net use x: \\server\share

rem if net use did not work wait another 30 secs then try again

if errorlevel 0 goto next
net use x: \\server\share

:next
net use y: \\otherserver\othershares

Steve
Avatar of regsamp
regsamp

ASKER

Is there a way to edit the script so that it is not pinging and just a straight delay in the batch file because this laptop is on a network that is behind a firewall, behind a router, going to remote network, etc, etc.?  For example, a straight batch file that just says something like mapped drive net use z(or which ever drive letter is open): \\servername\sharename wait 60 seconds.
write a batch file with sleep.exe

This command will put a pause in for the seconds you specify.  
Avatar of regsamp

ASKER

I do not easy access to sleep.exe and should be another way to specify a delay in seconds in a straight batch file for mapped drives.  
SOLUTION
Avatar of rsivanandan
rsivanandan
Flag of India 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 regsamp

ASKER

"Edit the Group Policy for the Domain or the Local Policy on the machine as below;
Computer Configuration->Admin Templates->System->Logon->Always wait for the network at computer start and logon
This will make sure that the computer makes sure to wait till the network to come active before it attempts to map the drives and you'll be okay."  We had the remote user do this and they stated it worked for only one reboot and it no longer works.  


Do you have a Domain Policy? Try to set it onto the domain policy because it will override the local policy upon connection.

Cheers,
Rajesh
Avatar of regsamp

ASKER

This computer is located at an employee's home and it is a spare laptop on their network.  They connect through a firewall, through a VPN tunnel to our firewall.  The group policies do not affect this computer.  A login script in batch format with net use x: \\server\share in a delay would be ideal.  
You can always download sleep.exe from the Internet and place the exe on your NETLOGON share or wherever the mapping runs from.  
ASKER CERTIFIED SOLUTION
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 regsamp

ASKER

We do not have a netlogon share for remote users.  This user has a laptop that has wireless connectivity and when he turns on the machine, the mapped drives try to connect before the actual network wireless connection is established (going through a firewall, router, ISP, etc) with the credentials saved in Managed Passwords in Windows and because the drives cannot connect because the network connection is not established, any network apps that are started will not run unitl the user goes into My Computer and connects each drive.  Now I do not have access to the machine to install sleep.exe and then try a few things and they have tried "Edit the Group Policy for the Domain or the Local Policy on the machine as below;
Computer Configuration->Admin Templates->System->Logon->Always wait for the network at computer start and logon" with no change after one reboot but if I can give him some kind of simple batch file which will cause a delay in the mapped drives trying to connect or even a registry setting that will cause a delay then that would be ideal.  
That is what I mentioned above. Create the logon script (as above) and have 'em post it to the startup folder. The other setting in the policy is already done right? So you don't have to do anything more.

Cheers,
Rajesh
Avatar of regsamp

ASKER

"To speedup things, use the server's ip instead of name or add the resolution in the 'hosts' file. Try this and post it here. Also what kind of VPN are you using?"  Which server IP or do you mean is ISP server and we use SonicWall for VPN tunnels.  
Avatar of regsamp

ASKER

rsivanandan, should we use net use z: /delete before net use Z: \\computerip\sharename /u:domain\username <password> in the batch file?  
SOLUTION
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 regsamp

ASKER

Isiqow, I will try your script and substitute the drive letters for ours and the server and share names.  Can ip addresses be used instead of names and the rest is just copied exactly the same and called something.vbs, correct?  
SOLUTION
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
Raj has it right, IP's are fine.
Change drive letters, server name and share name and you should be ok. Just remember that if he is delayed logging into Active Directory or is relying on a cached policy the logon script will have to be executed on his local machine.

Isi
SOLUTION
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 regsamp

ASKER

Have not tried the ping parameter and the drive mappings are being put back by windows and this is machine is not a member of the domain and does not use a login script.  I am taking a look at the script options mentioned above and starting to try them.