Task scheduler and robocopy

Mary Martin 1 Reputation point
2022-07-15T13:25:19.417+00:00

Good morning:

I'm having a very odd issue with Task Scheduler and Robocopy on a Windows Server 2016 machine.

I have script that uses net use to connect to a server on a different domain. I am able to get to that server and go to various folders using the provided credentials with no errors or issues. The script then calls robocopy to copy files and subdirectories to a server on our local domain. I can run this script manually with no problem. When I put it in Task Scheduler and run it from there, the log file keeps giving me this error:

ERROR 1907 (0x00000773) Accessing Source Directory <directory name> The user's password must be changed before signing in.

Neither the user used to run the task nor the user connecting to the other domain are flagged in AD to change their passwords. I can't figure out why I keep getting this message. Again, I can run the script manually with no errors, but when I try to run it using task scheduler I get this error.

Thanks in advance for any help you can offer,

Mary

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MotoX80 36,291 Reputation points
    2022-07-15T14:27:09.457+00:00

    Neither the user used to run the task nor the user connecting to the other domain

    Do both domains have an account with the same name? Is there a local account on the server with the same account name?

    Again, I can run the script manually with no errors, but when I try to run it using task scheduler I get this error.

    Check the security eventlog on the "source directory" server. You should see some logon event for that account or an event that references the machine that runs the script. Does it show the correct account domain?

    Build a test script (bat file) to verify authentication to that one server.

    net use x: \\server\share password /user:Domain\user     
    dir x:\    
    net use x /delete  
    

    Update: be sure to capture all stdout and stderr for any task that you run. In the task definition set it to execute cmd.exe. In the arguments field add the redirection. It should look like this:

    cmd.exe /c c:\scripts\YourScriptName.bat 1> c:\temp\myscript.log 2>&1  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.