net use and task scheduler headaches


R

Razvan Cosma

Greetings,
I am trying to use a very simple backup script that does something on
the lines of:

if exist y: net use y: /delete
(this one is needed just in case someone else logged on the system
mapped the same letter, and also to prevent a very annoying bug where
the mapped drive becomes "stale"? and although it is mapped I cannot
access the files)

net use y: \\1.2.3.4\share password /user:domain\user /persistent:no

xxcopy y:\files c:\ blah blah
(where xxcopy is a very handy utility from www.xxcopy.com)

The problem is while everything runs OK if started in a cmd prompt, when
I schedule it using either at or the task scheduler, it only works the
first time. Subsequent runs give the error:

System error 85 has occurred.
The local device name is already in use.

I have found several links to possible issues/solutions:
#1 A resource mapped by a logged on user cannot be unmapped by a
scheduled task.
This is very annoying as I could end up copying whatever data is on a
resource some user has assigned y: to
#2 A drive mapped by a background task cannot be accessed by an user
logged on interactively.
The solution to this is use different drive letters when running the
batch file from a command prompt.
#3 MS KB #253821
I tried altering the registry value - doesn't help and adds unneeded
security issues.
Also changing the timeout value for network shares from the default 15
minutes to whatever else does not work.

Thank you very much for any hints.
 
M

Marty List

Razvan Cosma said:
Greetings,
I am trying to use a very simple backup script that does something on
the lines of:

if exist y: net use y: /delete
(this one is needed just in case someone else logged on the system
mapped the same letter, and also to prevent a very annoying bug where
the mapped drive becomes "stale"? and although it is mapped I cannot
access the files)

net use y: \\1.2.3.4\share password /user:domain\user /persistent:no

xxcopy y:\files c:\ blah blah
(where xxcopy is a very handy utility from www.xxcopy.com)

The problem is while everything runs OK if started in a cmd prompt, when
I schedule it using either at or the task scheduler, it only works the
first time. Subsequent runs give the error:

System error 85 has occurred.
The local device name is already in use.

I have found several links to possible issues/solutions:
#1 A resource mapped by a logged on user cannot be unmapped by a
scheduled task.
This is very annoying as I could end up copying whatever data is on a
resource some user has assigned y: to
#2 A drive mapped by a background task cannot be accessed by an user
logged on interactively.
The solution to this is use different drive letters when running the
batch file from a command prompt.
#3 MS KB #253821
I tried altering the registry value - doesn't help and adds unneeded
security issues.
Also changing the timeout value for network shares from the default 15
minutes to whatever else does not work.

Thank you very much for any hints.

Before you spend too much time on the error 85, have you tried using UNC
paths and avoiding mapped drives altogether? I rarely map drives any more.
Try this:

net.exe use \\1.2.3.4\share password /u:domain\user /p:n

xxcopy.exe \\1.2.3.4\share\files c:\ blah blah
 
Ad

Advertisements

R

Razvan Cosma

Marty said:
Before you spend too much time on the error 85, have you tried using UNC
paths and avoiding mapped drives altogether? I rarely map drives any more.
Try this:

net.exe use \\1.2.3.4\share password /u:domain\user /p:n
Nope, syntax error.
 
M

Marty List

Razvan Cosma said:
Nope, syntax error.
It's something simple, just read the syntax and try it again. I was just
pasting what you had used before, but you can't use /p:n on deviceless/UNC
connections. Try this:

net.exe use \\1.2.3.4\share /user:domain\user password
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Scheduled Tasks 1
[?]scheduled tasks 5
Scheduling task with AT 7
Using the scheduled tasks in cmd mode 6
scheduled task question 1
task scheduler tâches 1
scheduled task (batchfile) 1
%username% scheduled task 9

Top