wmic output hangs when using psexec

I recently found when trying to issue a wmic query on a remote system with psexec (1.98) it would hang and not display results.
The solution is to redirect STDIN to NUL.

psexec computer cmd /c "wmic path win32_usbcontroller < NUL:"

I found this solution on Sysinternals forums from June 2011.

Published by

Rich

Just another IT guy.

3 thoughts on “wmic output hangs when using psexec”

  1. Hi , i am using PSExec to run some process on remote system,
    but when i run it ,it is working but the GUI of that process is hanged,
    I tried it with Calc,it is also showing black screen on Remote system.
    Please let me know if you can do some thing

    1. You could use something like

      tasklist /s REMOTECOMPUTER /v | find /I calc.exe

      When you have the PID, you can then just kill the process from the remote computer using:

      taskkill /s REMOTECOMPUTER /F /FI PID eq #PID#

      Or if you are certain it’s not going to affect anyone else on remote system, you can terminate tasks based on image name:

      taskkill /s REMOTECOMPUTER /F /IM calc.exe
  2. Hi Rich Thanks for Reply,
    I think i have not explained my self properly,
    i want to start a task on Remote computer ,i am using PSExec command for that as follow
    psexec RemoteComputer -i 1 -d “calc”
    it is stating a process on remote system,but when i check on remote system the GUI window for Calc is complety black. nothing is being show on remote system.
    i want to show the process correctly with their proper output.means complete GUI Windows
    Please help

Leave a Reply to Rich Kreider Cancel reply

Your email address will not be published. Required fields are marked *