Win32ole and wmi


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?