#!/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.$namespace); ($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