D
Daniel Berger
Hi all,
Is there a way to use ExecMethod() on a SWbemServices object via
Win32::OLE? It seems you ought to be able to exec class methods
directly, rather than iterating all "InstancesOf" and calling method
on the objects individually. Yes, I'm aware of how to do it that way,
but I think somethink like the syntax below ought to work:
use strict;
use Win32::OLE qw(in with);
my $wmi = Win32::OLE->GetObject("winmgmts:\\");
my $rv = $wmi->ExecMethod("Win32_Service","StartService","ClipSrv")
or die "Error", Win32::OLE->LastError;
print "RV: $rv\n";
I messed around with "Invoke", but that didn't seem to work either. I
also tried playing around with the constructor for $wmi, but no luck.
Am I just doing it wrong? Or is something like the syntax above just
not possible?
Regards,
Dan
Relevant link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/swbemservices.asp
Is there a way to use ExecMethod() on a SWbemServices object via
Win32::OLE? It seems you ought to be able to exec class methods
directly, rather than iterating all "InstancesOf" and calling method
on the objects individually. Yes, I'm aware of how to do it that way,
but I think somethink like the syntax below ought to work:
use strict;
use Win32::OLE qw(in with);
my $wmi = Win32::OLE->GetObject("winmgmts:\\");
my $rv = $wmi->ExecMethod("Win32_Service","StartService","ClipSrv")
or die "Error", Win32::OLE->LastError;
print "RV: $rv\n";
I messed around with "Invoke", but that didn't seem to work either. I
also tried playing around with the constructor for $wmi, but no luck.
Am I just doing it wrong? Or is something like the syntax above just
not possible?
Regards,
Dan
Relevant link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/swbemservices.asp