Win32ole and wmi


#1

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



end

Which means I have to know all of the Win32_BIOS properties (and there
are lots of them) defined here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/computer_system_hardware_classes.asp

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

Thanks,
Brad