Re: Getting a list of Processes

fr Brad:

Sure, no problem… also, you can list more than the process name. I

like to show the PID and the executablepath, etc. Here are

other process

items you might like to examine:

class Win32_Process : CIM_Process

{

string Caption;

string CommandLine;

it would be nice if a particular ruby win32ole method can expose all
those attributes without looking thru msdn docs, no? similar to an ole
browser yet in ruby lib format…

thanks and kind regards -botp

Peña, Botp wrote:

it would be nice if a particular ruby win32ole method can expose all
those attributes without looking thru msdn docs, no? similar to an ole
browser yet in ruby lib format…

thanks and kind regards -botp

I agree. I do it in Python (with the wmi module) like this:

c = wmi.WMI()
for item in c.Win32_Process():
print item

I don’t know who to contact about it. Is there a formal request process
for Ruby additions someplace?

Peña, Botp wrote:

fr Brad:

Sure, no problem… also, you can list more than the process name. I

like to show the PID and the executablepath, etc. Here are

other process

items you might like to examine:

class Win32_Process : CIM_Process

{

string Caption;

string CommandLine;

it would be nice if a particular ruby win32ole method can expose all
those attributes without looking thru msdn docs, no? similar to an ole
browser yet in ruby lib format…

Here it is…I think this is what you were looking for.
It displays all of the properties for a WMI Class.

require ‘win32ole’

class MyClass
def get_process_info()
procs = WIN32OLE.connect(“winmgmts:\\.”)
rst = procs.ExecQuery("SELECT * FROM meta_class WHERE class =
‘Win32_Process’")
rst.each do |x|
puts x.path
.Class.to_s #The Class Name
x.properties
.each do |m|
puts " " + m.Name.to_s #Available Properties of this Class
end
end
end
end

a = MyClass.new
a.get_process_info()