0

I am using PSExec to run scripts on multiple computers and after a few computers I start getting connection errors (probably because of concurrent connections limit on Windows 10).

PSExec command I am currently using:

psexec.exe @pc_list.txt -h -u psexec_username cmd /c "\\win10pc\path\script.cmd"

In the scripts I use pushd command to map the path to script/installer location, run installer if applicable and close with popd.

setlocal EnableDelayedExpansion
pushd "%~dp0"
if "!current_version!" neq "!new_version!" (msiexec /i "!installer!" /qn /norestart)
popd
endlocal

How can I close the connection after script ends on one computer and PSExec starts connecting to the next computer in the queue?

jacob_w
  • 3
  • 3
  • The concurrent connection limit does apply only to incoming connections. Since your connections are outgoing, this is not the cause of your issues. – Daniel Jan 27 '22 at 21:38
  • @Daniel While there is outgoing psexec connection from host to a remote computer there is also a connection from remote computer to the host (to run the script which temporarily maps remote path, verifies if and which installer to use and runs installer which is executed from the host). I would agree with you if I were to rewrite the script to copy the files and run them on remote computer (since I already have my scripts I thought closing connection might be easier). – jacob_w Jan 28 '22 at 20:06
  • I don't know enough about cmd scripting. But my suggestion would be to use PowerShell PSSessions to both copy file over the PSSession to the target computers and invoke whatever command or program you need to run. This will likely simplify your task. – Daniel Jan 28 '22 at 20:19

0 Answers0