I have created a program in Java that executes a PSEXEC
command. Whenever I run the program individually it works fine.
But when the program runs 5 times at the same time, only the first instance was successful the other 4 failed to execute.
Is there any way that I can execute a multiple instance of PSEXEC
command?
Below is my Java program:
String command = "CD <PSTools Location> && psexec \\\\" + <servername> + " -u " + <user> + " -p " + <password> + " -i 2 cmd /c wscript.exe <vbScriptName>.vbs";
Process p = Runtime.getRuntime().exec("cmd /c "+ command);
p.waitFor();