Forum: Ruby win32ole and wmi

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
02bd6b98b7c04f9ae5868eda3d01fb73?d=identicon&s=25 Brad Tilley (rtilley)
on 2006-04-14 14: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
  ...
  ...
  ...
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=...

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

Thanks,
Brad
This topic is locked and can not be replied to.