Forum: Ruby win32ole and wmi

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Brad T. (Guest)
on 2006-04-14 16:36
In Python, this will list all of the instances of Win32_BIOS:

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

In Ruby, I can't do this. The closest I've come is this:

require 'win32ole'
bios = WIN32OLE.connect("winmgmts:\\\\.")
bios.InstancesOf("win32_bios").each do |b|
  puts b.serialnumber
  puts b.version
  puts b.smbiosbiosversion

Which means I have to know all of the Win32_BIOS properties (and there
are lots of them) defined here:

Is there a way to make Ruby do this more like Python?

This topic is locked and can not be replied to.