WMI and WIN32OLE issues

S

Spike

Hello,

Having difficulty pulling information from a remote system with Ruby
and WMI. In the past, I've used VB.NET for WMI access. Some code ideas
have moved over quickly, but others stymie me.

For quick inventory management, I'd like to connect to other network
PCs, grab some data, and pass it along to another system for storage.
I've used Microsoft's WMI tools to ID classes and methods I care about.
Here's an example:

Remote host: Dell_1
Class: MPIO_WMI_METHODS
Method from that class: GetPathConfiguration

GetPathConfiguration returns a struct with three members, Description
(string), Implemented (boolean), and WmiMethodId (sint32).

Maybe I know too little about WMI or WIN32OLE objects, but it seems to
me this should work:

#locate MPIO devices, if installed
mpio_locator = WIN32OLE.new("WbemScripting.SWbemLocator")
mpio_server =
mpio_locator.ConnectServer("Dell_1","root\\wmi","Administrator",password)
mpio = mpio_server.InstancesOf("MPIO_WMI_METHODS")

That all works fine. The next part does not.

#next line triggers "unknown property or method
`GetPathConfiguration'"
devices = mpio.GetPathConfiguration()
devices.each do |device|
puts "#{device.Description}<br>"
end

Is there a syntax to calling the method I'm messing up? Something else
obvious?

Spike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top