I will be monitoring/logging (and later on reacting to) certain processes. At the moment I am after ProcesID and ProcessMemory. I am currently using the following WMIC and cmd line queries to get the desired information (and some necessary parsing):
wmic process where name=“lync.exe” list brief /format:csv
tasklist /fi “imagename eq lync.exe” /fo:list
I was wondering if there was some better (more elegant) means of doing this. I looked at WFS but nothing jumped out.
Thanks in advanced.
In the WFS there is ProcessInformationWFS class and the GetActiveProcesses() protected method in the ProcessManagementWFS.
Look in this module to find infos about processes.
Did you check ProcessMBS class in MBS Plugins?
@Maurizio Rossi & @Christian Schmitz - thanks for that info
For now I will use the following WMIC commands as I can parse through them fairly easy and can use them from Win7 through Win10:
wmic process where name='lync.exe' get processId /format:csv
wmic process where name='lync.exe' get WorkingSetSize /format:csv
I looked at WFS and could not find the information in a simple format. But I think the information is capture (as a Variant right now) under the ProcessInformationWFS object.
I am looking into the ProcessMBS class to learn about that plugin. It has a bunch of other useful things.
As for the use. I have some internal processes and one external process (Lync as you may have guessed by now) that are ill behaved (mostly in Win7) and the garbage collector does not seem to like them too much (i.e. memory keeps creeping up and does not seem to release as quickly as it does on Win8 and Win10). We will be monitoring them and acting on them if they become to unwieldy.
Thanks to both. I am not sure I can mark both answers as the right one. So I marked the first one.
for WMI you can also use MBS Plugins. We have WMI classes to do queries without external apps.