copy with PSEXEC hangs some times in batch execution

341 views Asked by At

im copying multiple files to server Machine using PSEXEC,Calling Psexec is through perl file

my $exit_code5 = system("cmd /c c:\\PsExec.exe \\\\$host_name  -u  $user_name  -p \ $pwd  cmd /c xcopy \"\\\\$client\\c\$\\sif folder\\$val\" \"c:\\sif folder\\\" /O /X /E /H /K /Y /q");
sleep(20);

}
if($exit_code5!=0)
{
}

This command is working fine , but sometimes in batch executions it randomly fails

-----Copying files to  BackUpFolder SiebsvrBackUp created in C Drive-----
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

and will be in hang state... Is there any consistent way to perform multiple file copy using PSEXEC, Have tried COPY Command to, but no use

1

There are 1 answers

0
HashSu On

Try adding -d in your command since it doesn't wait for the process to terminate https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx