# Re: Getting a list of Processes

**URL:** <https://www.ruby-forum.com/t/re-getting-a-list-of-processes/95779>\
**Category:** Ruby\
**Created:** [June 13, 2006, 1:12pm UTC](https://www.ruby-forum.com/t/re-getting-a-list-of-processes/95779 "2006-06-13T13:12:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [June 13, 2006, 1:12pm UTC](https://www.ruby-forum.com/t/re-getting-a-list-of-processes/95779/1 "2006-06-13T13:12:33Z")

</div>

fr Reggie Mr:

# 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()

cool, Reggie. Thanks much.

I’ve modified it a bit, if u don’t mind.

#-------  
class WMI  
require ‘win32ole’

def initialize  
@procs = WIN32OLE.connect(“winmgmts:\\.”)  
end

def get\_class(wmi\_class)  
rst = @procs.ExecQuery("SELECT \* FROM meta\_class WHERE \__class =  
‘#{wmi\_class}’")  
rst.each do |x|  
x.properties_.each do |m|  
yield m if block\_given?  
end  
end  
end  
end

a = WMI.new

puts “—get process names----”  
a.get\_class(“Win32\_Process”) do |cl|  
puts cl.name  
end

puts “—get registry names----”  
a.get\_class(“Win32\_Registry”) do |cl|  
puts cl.name  
end  
#----

I have a problem though, how do i get other properties besides the name,  
eg cl.name, i tried cl.description but it does not work.  
sorry if this is too simple. i do not do windows programming.

kind regards -botp

---

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [June 13, 2006, 1:50pm UTC](https://www.ruby-forum.com/t/re-getting-a-list-of-processes/95779/2 "2006-06-13T13:50:19Z")

</div>

> I have a problem though, how do i get other properties besides the name,  
> eg cl.name, i tried cl.description but it does not work.  
> sorry if this is too simple. i do not do windows programming.
> 
> kind regards -botp

The only other property values avialable are:  
CIMType Type of this property.  
IsArray Boolean value that indicates if this property has an array  
type.  
IsLocal Boolean value that indicates if this property is local.  
Name Name of this WMI property.  
Origin Contains the originating class of this property.  
Qualifiers An SWbemQualifierSet object, which is the collection of  
qualifiers  
for this property.  
Value Actual value of this property. This is the default  
automation  
property of this object.

It’s available at this link:

> **[Technical documentation](https://learn.microsoft.com/en-us/docs/)**
