Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » perl sample

Win32_ClassicCOMClassSetting perl sample code

The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_ClassicCOMClassSetting WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Description

The Win32_ClassicCOMClassSetting WMI class represents the settings of a COM component.

Sample Code

use strict;
use Win32::OLE('in');

use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

my @computers = ("DELL17");
foreach my $computer (@computers) {
   print "\n";
   print "==========================================\n";
   print "Computer: $computer\n";
   print "==========================================\n";

   my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
   my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_ClassicCOMClassSetting", "WQL",
                  wbemFlagReturnImmediately | wbemFlagForwardOnly);

   foreach my $objItem (in $colItems) {
      print "AppID: $objItem->{AppID}\n";
      print "AutoConvertToClsid: $objItem->{AutoConvertToClsid}\n";
      print "AutoTreatAsClsid: $objItem->{AutoTreatAsClsid}\n";
      print "Caption: $objItem->{Caption}\n";
      print "ComponentId: $objItem->{ComponentId}\n";
      print "Control: $objItem->{Control}\n";
      print "DefaultIcon: $objItem->{DefaultIcon}\n";
      print "Description: $objItem->{Description}\n";
      print "InprocHandler: $objItem->{InprocHandler}\n";
      print "InprocHandler32: $objItem->{InprocHandler32}\n";
      print "InprocServer: $objItem->{InprocServer}\n";
      print "InprocServer32: $objItem->{InprocServer32}\n";
      print "Insertable: $objItem->{Insertable}\n";
      print "JavaClass: $objItem->{JavaClass}\n";
      print "LocalServer: $objItem->{LocalServer}\n";
      print "LocalServer32: $objItem->{LocalServer32}\n";
      print "LongDisplayName: $objItem->{LongDisplayName}\n";
      print "ProgId: $objItem->{ProgId}\n";
      print "SettingID: $objItem->{SettingID}\n";
      print "ShortDisplayName: $objItem->{ShortDisplayName}\n";
      print "ThreadingModel: $objItem->{ThreadingModel}\n";
      print "ToolBoxBitmap32: $objItem->{ToolBoxBitmap32}\n";
      print "TreatAsClsid: $objItem->{TreatAsClsid}\n";
      print "TypeLibraryId: $objItem->{TypeLibraryId}\n";
      print "Version: $objItem->{Version}\n";
      print "VersionIndependentProgId: $objItem->{VersionIndependentProgId}\n";
      print "\n";
   }
}