[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1258
  • Last Modified:

Get Process ID from TypePerf

I am working on adding some functionality to some monitoring scripts that we have running.  Currently I am using typeperf to output a list of all the processes and their CPU data.  I need to find a way to get the Process ID that matches the Process that typeperf lists so that I can track the process back.  Any ideas?
0
LiberatingInsight
Asked:
LiberatingInsight
  • 2
2 Solutions
 
RafaelCommented:
Have you tried Microsoft's "tlist.exe" command  ?

After running the command an example output would be as follows:

c:\>tlist

   0 System Process  
   4 System          
 308 smss.exe        
 356 csrss.exe        
 380 winlogon.exe      NetDDE Agent
 424 services.exe    
 436 lsass.exe      
 604 svchost.exe    
 776 svchost.exe    
 852 spoolsv.exe    
1000 clisvcl.exe    
1036 InoRpc.exe      
1064 InoRT.exe      
1076 InoTask.exe    
1244 WTTSvc.exe        
1492 Sysparse_com.exe  OleMainThreadWndName
1980 explorer.exe      Program Manager
1764 launch32.exe      SMS Client User Application Launcher
1832 msmsgs.exe        MSBLNetConn
2076 ctfmon.exe        
2128 ISATRAY.EXE       IsaTray
4068 tlist.exe
0
 
LiberatingInsightAuthor Commented:
I found a solution...
First I run task list /v /fo csv and output that to a file
Then I run the following:
typeperf "\Process(*)\ID Process" -sc 1 > %tempdir%\ProcessPerf.csv && typeperf "\Process(*)\% Processor Time" -si 10 -sc 6 >> %tempdir%\ProcessPerf.csv

The above gives me an output of the PID for all of the running process and the matching TyePerf name and outputs it to a CSV file.  Then the second part of the command adds 6 sample sets taken 10 seconds apart.

Now I can review the processes and if something is out of range I can track it back to the Process ID and user that has it running.

Thank you very much for your help.
0
 
LiberatingInsightAuthor Commented:
I was able to find the solution through further research.  Thanks for helping me get there!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now