psexec against list of servers

Matt 101 Reputation points
2022-06-29T14:14:04.043+00:00

HI all,

When I run psexec @Gaydamak ipconfig, it took so long and if some servers inside @Gaydamak are not up, pseexec could wait for almost 2 minutes.
Is there a way to set retry time or timeout to be short like 1 sec? BTW, multiple servers name inside file .

Thank you!

Sysinternals
Sysinternals
Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,082 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 47,626 Reputation points
    2022-06-29T15:18:06.623+00:00

    Documentation for PsExec is here. It says to use the -n parameter to specify a timeout connecting to the server. This seems like it would solve the issue of the server being unavailable.

    ipconfig should be a fast call so I don't know that you would need to do anything else but passing a list of files to psexec means it'll run them one by one. If you need even "faster" results then don't pass a list of computers to the command but instead use Powershell's parallel capability to start a separate psexec process/job for each computer (or batch if there are a lot of them) and let them run in parallel. You can read more about that here. To give you an idea of the impact suppose you had 10 servers and each one took 1 second to run your command. The total time would be 10 seconds (+ overhead). However if you started them all at once (within limits) then they would run concurrently and potentially be done in 1 second (+ overhead).


0 additional answers

Sort by: Most helpful