Search code examples
batch-filecmdpsexec

PSexec file on list of computers speed up


I was hoping I could have some help with this. I have about 300 computers that I have to clear all the temporary internet folders on and separately do a logoff on them.

Currently I have a file located on the C: drive that has the following command:

  • Clear temporary internet folders:

    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
    
  • log off

    shutdown /l /t 0 /f
    

Here is the PSexec command I use to remotely execute that command on every computer:

@echo off

psexec @C:\_\complist.txt -u Admin -p PASSWORD -i.    c:\clearcache.cmd

The problem I am having is that it is taking really long, about 30 - 35 minutes because it does one at a time. Is there anyway I can speed this up? Maybe instead of doing 1 at a time I can do all at once?

If anyone can help improve the speed or help me find a better way I would be so grateful.

Thanks

Error I am getting when executing: Execute error


Solution

  • the other way round: instead of doing all at once, do them separately. Sounds contraproductive? Parse complist.txt with batch and start psexec for each single computer instead of a list of computers:

    for /f "delims=" %%i in (C:\_\complist.txt) do (
      start "%%i" psexec \\%%i -u Admin -p PASSWORD -i.  c:\clearcache.cmd
    )
    

    start creates a new process for executing psexec on every single computer and doesn't wait for it to finish, so they all run (nearly) parallel.