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
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