Using Win32OLE, WMI and ExecMethod

D

Daniel Berger

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
 
D

Daniel Berger

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
 

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
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top