net use and task scheduler headaches

Discussion in 'Microsoft Windows 2000 CMD Promt' started by Razvan Cosma, Jan 5, 2004.

  1. Razvan Cosma

    Razvan Cosma Guest

    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: \\\share password /user:domain\user /persistent:no

    xxcopy y:\files c:\ blah blah
    (where xxcopy is a very handy utility from

    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.
    Razvan Cosma, Jan 5, 2004
    1. Advertisements

  2. Razvan Cosma

    Marty List Guest

    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 \\\share password /u:domain\user /p:n

    xxcopy.exe \\\share\files c:\ blah blah
    Marty List, Jan 6, 2004
    1. Advertisements

  3. Razvan Cosma

    Razvan Cosma Guest

    Nope, syntax error.
    Razvan Cosma, Jan 6, 2004
  4. Razvan Cosma

    Marty List Guest

    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 \\\share /user:domain\user password
    Marty List, Jan 6, 2004
  5. Razvan Cosma

    Razvan Cosma Guest

    Ah, yes. That's it. Thanks a lot.
    Razvan Cosma, Jan 7, 2004
    1. 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 (here). After that, you can post your question and our members will help you out.