Changing net use timeout
Solution 1
The correct answer is to probably figure out why they can not map the drive. To answer your question, net use does not have a time out command:
C:\Users\user>net use /? The syntax of this command is:
NET USE [devicename | *] [\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username] [/USER:[dotted domain name\]username] [/USER:[username@dotted domain name] [/SMARTCARD] [/SAVECRED] [[/DELETE] | [/PERSISTENT:{YES | NO}]]
NET USE {devicename | *} [password | *] /HOME
NET USE [/PERSISTENT:{YES | NO}]
However if you want your script to keep on moving while your net use command figures it's self out you could use the start
command to launch it in a new window and the normal script should be able to keep doing what ever you want it to do. start net use \\\computername\sharename x:
Solution 2
start your Timer run NET USE with "start" as supposed. send your Batch into a loop
- check if the netshare is already connected.
- If yes Exit loop,
- if not check if timer has exceeded
-
- if yes - Echo Error and exit Do what you want to do :)
Kind regards Johannes
Related videos on Youtube
Joshua Nurczyk
Updated on September 18, 2022Comments
-
Joshua Nurczyk almost 2 years
I have a script that runs against remote sites to map a drive and work with a file. I use
Test-Connection
to make sure the remote server is alive, then attempt to map the location needed withnet use
. My problem is that, depending on who runs the script a certain subset of remote locations is pingable, but cannot be mapped. Is there any way to makenet use
time out after a shorter time, or another way to do this with Windows 7 or 2008 commands? -
Joshua Nurczyk about 10 yearsThat's pretty much what I had determined, but I was hoping for a better answer. If no better answer pops up, I'll accept this one in a day or two.
-
Nixphoe about 10 years@JoshuaNurczyk have you looked and how to map a network drive with GPO? Or would that not apply?
-
Joshua Nurczyk about 10 yearsUnfortunately, it would not apply. It has to do with how the network is set up, and I have no way to fix it myself.