Based on information from my previous question, I'm trying to learn wmic.
I'm playing around with trying to look at which processes are using the most resources on a remote server. What I've managed to come up with is near the bottom of this post. It works very well on my local machine, but when I psexec into a server (Windows 2003 or 2008) and try to run this command, it hangs nearly every time. I can't even ctrl+c to get it to stop. I used RDP (using a different username) to get into one of the machines where this command hangs. The username that sends the command from psexec shows two items listed in Task Manager, cmd and wmic. They've remained in Task Manager several hours after sending the command. When I end them, it frees up my console on my local machine.
I've tried looking up reasons this might be hanging, and I cannot find anything. I also asked one of my system admins, but those guys are always way too busy to help a lowly NOC guy (legitimately, though. They really are very busy). Any ideas as to what might be going wrong?
wmic path win32_perfformatteddata_perfproc_process where (PercentProcessorTime != 0) get Name, PercentProcessorTime, IDProcess