This piece of code displays all the properties (with their values) that are available for a WMI class method.
With it, you have to change just 1 parameter in stead off all the properties.
By changing the variables, you can change either the computer, namespace or class method.
I've tested in on an Windows XP SP2 machine, and had no problems so far.
(Thanks to the Microsoft Scripting guys for the vb code)
#!/usr/local/perl
use Win32::OLE('in');
use strict;
my $stepOk = 1;
my $errorMsg = "";
# Variables
my $wmiService = "";
my $computer = "."; # Computer to connect to: . = local host
my $namespace = "\\root\\cimV2"; # Namespace to connect to
my $class = "CIM_Controller"; # Class Method from which you want
+to retrieve the properties
$wmiService = Win32::OLE->GetObject("winmgmts:\\\\".$computer.$namespa
+ce);
($stepOk = 0) unless $wmiService;
if(! $stepOk)
{
$errorMsg = "Unable to open wmi services";
print $errorMsg."\n";
}
else
{
my $subDevices = $wmiService->ExecQuery("Select * from ".$class);
print "***********************************************\n";
foreach my $subDevProp ( in( $subDevices ) )
{
foreach my $prop (in($subDevProp->{Properties_}))
{
print "***** ".$prop->{Name}.": ".$prop->{Value}."\n";
}
print "*********************************************\n";
}
}
# Scripted by jschollen
# Thanks to the Microsoft Scripting Guys