How to get my PsExec gpupdate 'for' command to execute concurrently

meirionwyllt
meirionwyllt used Ask the Experts™
on
I currently have a very simple batch file that I use to do a 'gpupdate' on my 45 XenApp servers.  What I have is...

for /f %%i in (\\server\software\Batches\XEN##.txt) do \\server\software\Batches\PsExec.exe \\%%i gpupdate

and then in the XEN##.txt file I have a list of my 45 servers.

This works great, however it can only do it sequentially, i.e. it takes more than 30 seconds to finish the gpupdate on XEN01, and only then will it begin the gpupdate on XEN02, so of course it takes almost 30 mins to finish doing all of them.

Is there a way to restructure the above so that the gpupdate command runs simultaneuosly on all the 45 servers?

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Technical Lead - Network Support
Commented:
Hi,

Have you tried to use a "-d" switch for the task to "Don't wait for process to terminate (non-interactive)"?

(https://docs.microsoft.com/en-us/sysinternals/downloads/psexec)

Thanks,
meirionwylltSenior Desktop Engineer

Author

Commented:
Excellent!  That worked.  Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial