The last part of the triology ;-)
After retrieving all namespaces and all the properties of the classes, this piece of code retrieves al the classes within a given namespace.
It works for me ('till now) and I'm using it on Windows XP SP2.
(thanks again to the Microsoft Scripting Guys for the vb code)
use Win32::OLE('in');
use strict;
my $stepOk = 1;
my $errorMsg = "";
my $wmiService = "";
my $computer = "."; # Computer to connect to: . = local host
my $namespace = "\\root\\cimV2"; # Namespace to connect to
my @classes = ();
$wmiService = Win32::OLE->GetObject("winmgmts:\\\\".$computer.$namespa
+ce);
my $subDevices = $wmiService->SubclassesOf();
foreach my $subDevProp ( in( $subDevices ) )
{
print "Class $count: ".$subDevProp->{Path_}->{Path}."\n";
if($subDevProp->{Path_}->{Path} =~ /.*:(.*)/)
{
my $class = $1;
print "Detected class: $class\n";
push(@classes,$class);
}
}
# Scripted by jschollen
# Thanks to the Microsoft Scripting Guys