Hello @Young Sunny ,
Thank you for your question.
A known solution for this exact error is to kill any rogue psexecsvc.exe process on the target machine. While this works for remote callers, I suspect it can also solve local issues.
If psexecsvc.exe hangs after using psexec, something is probably wrong, such as an application crash or simultaneous remote executions with incompatible versions.
Some things to look at are;
1) Clean up older instances of psexecsvc.
2) Make sure you have the latest version of pstools.
3) Make sure you use the same versions of psexec on all your machines.
4) Use the scavenging process to find out what events are leaving the psexecsvc process running. psexecsvc.exe should automatically exit and remove itself from %windir%, where it is temporarily placed at runtime.
Cleaning up fake copies:
1) Check the %windir% directory and make sure there are no harmful files there.
2) In some reported cases, psexecsvc is being incorrectly copied to the %% windir% \ system32 directory. If that's the case and it continues to happen, look at your environment variables, user profiles, and credentials. The path is based on "Admin$" and should be %windir%.
Workarounds if all else fails:
1) Find a way to terminate the psexecsvc.exe process as part of the cleanup.
2) provide a top level username/password that is an administrator on the target machine and has domain level access to mapped network drives (where the .bat file was located).
If the answer was helpful, please don't forget to vote up or accept as an answer, thanks.
Yours sincerely,
Samuel