Here’s a quick command line method for grabbing CPU usage of a process by process id, process name, or caption.
By Process ID
wmic path win32_perfformatteddata_perfproc_process where (IDProcess = '3488‘) get Name, Caption, PercentProcessorTime, IDProcess /format:list
By Process Name
wmic path win32_perfformatteddata_perfproc_process where (Name=’iexplore’) get Name, Caption, PercentProcessorTime, IDProcess /format:list
By Process Name (fuzzy)
wmic path win32_perfformatteddata_perfproc_process where (Name like ‘%iexp%’) get Name, Caption, PercentProcessorTime, IDProcess /format:list
Any processes with CPU time over 50%
wmic path win32_perfformatteddata_perfproc_process where (PercentProcessorTime ^> 50) get Name, Caption, PercentProcessorTime, IDProcess /format:list




Nice Job, I’ve been searching for this a long time and that one of CPU higher than is neat.
One question tough, do you know if I can search for a specific process with CPU time over 50%?.
Would be like the merger of 2 querys but I don’t know how to do it.
Thank you
This, for example, will find processes with CPU time over 5% in this example. Replace 5 with the % you would like. Let me know if this works for you.
Note: This is one long line. Also, looks like there is a problem with this <code> or <pre> tag; It puts a space between the ^< ^> which it shouldn’t so if you copy and paste this it will give you an invalid query. Take the space out from between each of the ^< ^>.
wmic path win32_perfformatteddata_perfproc_process where (PercentProcessorTime ^> 5 and Name ^< ^> "_Total" and Name ^< ^> "Idle") get Name, Caption, PercentProcessorTime, IDProcess /format:listI’m not sure I understand what you ask about searching for a specific process over 50%. Can you elaborate?
Hey thank you for the really fast answer.
The script works like a charm for me, but one last thing, could be modified so only look to one specific process?, for example the process iexplore
Thank you
I guess this is the one
wmic path win32_perfformatteddata_perfproc_process where (PercentProcessorTime ^> 5 and Name ^ “_Total” and Name ^ “Idle” and Name ^ “wmiprvse” and name=’w3wp’) get Name, PercentProcessorTime, IDProcess /format:list
:-)
wmic path win32_perfformatteddata_perfproc_process where (PercentProcessorTime ^> 5 and Name ^< ^> "_Total" and Name ^< ^> "Idle" and Name LIKE "iexplore%") get Name, Caption, PercentProcessorTime, IDProcess, CreatingProcessID /format:listWhen you look at the results, you’ll see the CreatingProcessID in this now; Each tab runs under it’s own process ID. If you want to get details about the iexplore.exe process itself, you will want to query the PROCESS alias or win32_process path.
wmic process where (handle = "2788") get /ValueThis will give you details on the actual iexplore.exe process.
But at the end of the day there is a problem.
For some reason sometimes I get “No Instance(s) Available”, even when I can see in the task manager that the process is right about my mark, also I just get 100 or 0 instead of the real value which should be between 5 to 50
Thank you for your help
Are you doing this from the command line or in a batch file?
From the command line first then I will use a batch file
You could try just logging some entries for the process to CSV format and reviewing them.
logman create counter w3wp_proc -c "\Process(w3wp*)\% Processor Time"logman update w3wp_proc -si 10 -f csv -v mmddhhmm
That will update every 10 seconds. To stop it, just:
logman stop w3wp_procJump into c:\perflogs\ and open up the CSV that will be in there for w3wp_proc. Maybe confirm if that counter isn’t broken by chance.