Net use on scheduled bat

0

I have this bat file scheduled in a windows server 2008 r2:

net use \\ip\share\employees\ /user:domain\user password
robocopy C:\Zucchetti\Timbrature\sicurezza\ \\ip\share\employees\ Timbrature_Giornaliere_5min.csv /R:0 /W:0 /v > C:\Zucchetti\Timbrature\sicurezza\logcopia.txt
del "Timbrature_Giornaliere_5min.csv"

If I run the bat manually the it runs fine. If I run the bat scheduled with windows server 2008 task scheduler wether the user is logged on or not I get the following error in the log:

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Thu Mar 21 16:52:00 2019

2019/03/21 16:52:00 ERROR 1326 (0x0000052E) Getting File System Type of Destination \\ip\share\employees\
Logon failure: unknown user name or bad password.

   Source : C:\Zucchetti\Timbrature\sicurezza\
     Dest - \\ip\share\employees\

    Files : Timbrature_Giornaliere_5min.csv

  Options : /V /COPY:DAT /R:0 /W:0 

------------------------------------------------------------------------------

2019/03/21 16:52:00 ERROR 1326 (0x0000052E) Accessing Destination Directory \\ip\share\employees\
Logon failure: unknown user name or bad password.

How could I make it work in a scheduled bat file?

batch-file
scheduled-tasks
asked on Stack Overflow Mar 21, 2019 by Malkavian • edited Mar 23, 2019 by Malkavian

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0