Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Using Ruby & WMI to Get Win32 Process Information (See related posts)

From the Ruby on Windows blog...

Use Windows Management Instrumentation (WMI) to get information about the Win32 processes being run.
require 'win32ole'

wmi = WIN32OLE.connect("winmgmts://")

processes = wmi.ExecQuery("select * from win32_process")

for process in processes do
    puts "Name: #{process.Name}"
    puts "CommandLine: #{process.CommandLine}"
    puts "CreationDate: #{process.CreationDate}"
    puts "WorkingSetSize: #{process.WorkingSetSize}"
    puts
end

Further details and discussion here.



You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts