Using Win32OLE, WMI and ExecMethod

Hi all,

Ruby 1.8.1
Windows 2000

I’m playing with WMI to control services via Ruby. I can list
services easily enough with InstancesOf(), but how do I call methods
on a class?

I tried something like this, but this is clearly illegal. Can someone
provide me with the right way to do what I’m trying to do here?

require "win32ole"
wmi = WIN32OLE.connect(“winmgmts://”)
wmi.ExecMethod(“Win32_Service”,“StartService”,“ClipSrv”) # Illegal

I’ve tried various connect strings and done some futzing, but no luck.
Please help. Thanks.

Dan

djberg96@hotmail.com (Daniel Berger) wrote in message news:<6e613a32.0406021831.6be37c0b@posting.google.com>...

Hi all,

Ruby 1.8.1
Windows 2000

I'm playing with WMI to control services via Ruby. I can list
services easily enough with InstancesOf(), but how do I call methods
on a class?

I tried something like this, but this is clearly illegal. Can someone
provide me with the right way to do what I'm trying to do here?

require "win32ole"
wmi = WIN32OLE.connect("winmgmts://")
wmi.ExecMethod("Win32_Service","StartService","ClipSrv") # Illegal

I've tried various connect strings and done some futzing, but no luck.
Please help. Thanks.

Dan

Never mind. It appears that you call the method on an instance within
an each block. Still, I think some form of ExecMethod ought to work.

Regards,

Dan