05 May, 2010

Querying WinXp Process Information

Deep down I've always been a Unix guy. I've grown to love the types of utilities and applications authored for Unix-like systems. Generally, they adopt flexibility that many UI-based operating environments lack. Case in point, the batch command syntax is far superior to any Windoze has or likely will offer and as a result I often struggle to find similar features available when I am working in Windows. I recently learned something I felt was worth sharing.

The 'top' utility offers just about all you would require in monitoring your system performance. While task manager in Windows offers similar information I'd never found a means to pipe the output to a file for parsing and analysis. Today I found such a mechanism.

The 'wmic' utility available on multiple forms of Windows stands for 'Windows Management Instrumentation Command' and can offer similar information (and in some cases more info) than the equivalent use of 'top'. While you can initiate queries beyond processes I'm interested in process and memory utilization at this time.

Initiating the command:

wmic process get WorkingSetSize,Caption /format:csv >> c:\resources.log

Will query the memory utilization and name of all the processes currently running on the system, format into a comma-separated vector and append to the specified file. Wrap this fella in a loop, place in your start-up folder and you've got the makings of monitoring your system through initialization.


No comments: