-1

Using windows task scheduler i am running multiple commands, I'll call them task1.bat, task2.bat, and task3.bat . Each one of these scrips runs a different Psexec command (psexec version 2.11).

When running task1.bat, task2.bat, and task3.bat indivdually, these scripts run successfully; however when run in succession, task1.bat will run successfully, then task2.bat and task3.bat will usually fail with the error "Couldnt access servername. Access is denied. The syntax of the command is incorrect".

It seems like an error with Psexec, since when run individually the commands works fine. Is there a way to force Psexec to exit/end before moving onto the next script (besides just putting in a timeout)? It seems like psexec is hung which is causing the next to fail.

Buddy
  • 43
  • 1
  • 5
  • 1
    Can you copy and paste the exact command lines you are using and the output they produce? Open three `cmd` shells and have the command ready to run at the same time. What does that produce? – lit Apr 25 '17 at 00:09
  • What *exactly* do you mean by "run in succession"? If you're running them as separate tasks that all start at the same time, that might cause problems, as they will overlap one another. – Harry Johnston Apr 25 '17 at 00:41
  • Let's agree on terminology. "Successively" and "sequentially" means that one runs after another one completes and none run at the same time. "Concurrently" means that multiple processes run at the same time. Does the problem occur when psexec is run concurrently? – lit Apr 25 '17 at 01:22
  • Sorry, the processes are run sequentially. – Buddy Apr 25 '17 at 12:29
  • We still need to see the exact contents of the batch scripts and the command line that you are using to run them. – Harry Johnston Apr 25 '17 at 21:30

1 Answers1

0

The .bat script will run sequentially if you create and run the batch file:

CALL task1.bat
CALL task2.bat
CALL task3.bat
lit
  • 14,456
  • 10
  • 65
  • 119