# Win32ole and wmi

**URL:** <https://rubytalk.org/t/win32ole-and-wmi/26649>\
**Category:** ruby-talk\
**Created:** [14 April 2006 12:36 UTC](https://rubytalk.org/t/win32ole-and-wmi/26649 "2006-04-14T12:36:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brad5](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Brad5](https://rubytalk.org/u/Brad5)\
**Post date:** [14 April 2006 12:36 UTC](https://rubytalk.org/t/win32ole-and-wmi/26649/1 "2006-04-14T12:36:43Z")

</div>

In Python, this will list all of the instances of Win32\_BIOS:

import wmi  
c = wmi.WMI()  
for item in c.Win32\_BIOS():  
&nbsp;&nbsp;&nbsp;&nbsp;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|  
&nbsp;&nbsp;puts b.serialnumber  
&nbsp;&nbsp;puts b.version  
&nbsp;&nbsp;puts b.smbiosbiosversion  
&nbsp;&nbsp;...  
&nbsp;&nbsp;...  
&nbsp;&nbsp;...  
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](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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
