Contact Info

Crumbtrail

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

Win32_VideoController 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_VideoController WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Description

The Win32_VideoController WMI class represents the capabilities and management capacity of the video controller on a Windows computer system.

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_VideoController", "WQL",
                  wbemFlagReturnImmediately | wbemFlagForwardOnly);

   foreach my $objItem (in $colItems) {
      print "AcceleratorCapabilities: " . join(",", (in $objItem->{AcceleratorCapabilities})) . "\n";
      print "AdapterCompatibility: $objItem->{AdapterCompatibility}\n";
      print "AdapterDACType: $objItem->{AdapterDACType}\n";
      print "AdapterRAM: $objItem->{AdapterRAM}\n";
      print "Availability: $objItem->{Availability}\n";
      print "CapabilityDescriptions: " . join(",", (in $objItem->{CapabilityDescriptions})) . "\n";
      print "Caption: $objItem->{Caption}\n";
      print "ColorTableEntries: $objItem->{ColorTableEntries}\n";
      print "ConfigManagerErrorCode: $objItem->{ConfigManagerErrorCode}\n";
      print "ConfigManagerUserConfig: $objItem->{ConfigManagerUserConfig}\n";
      print "CreationClassName: $objItem->{CreationClassName}\n";
      print "CurrentBitsPerPixel: $objItem->{CurrentBitsPerPixel}\n";
      print "CurrentHorizontalResolution: $objItem->{CurrentHorizontalResolution}\n";
      print "CurrentNumberOfColors: $objItem->{CurrentNumberOfColors}\n";
      print "CurrentNumberOfColumns: $objItem->{CurrentNumberOfColumns}\n";
      print "CurrentNumberOfRows: $objItem->{CurrentNumberOfRows}\n";
      print "CurrentRefreshRate: $objItem->{CurrentRefreshRate}\n";
      print "CurrentScanMode: $objItem->{CurrentScanMode}\n";
      print "CurrentVerticalResolution: $objItem->{CurrentVerticalResolution}\n";
      print "Description: $objItem->{Description}\n";
      print "DeviceID: $objItem->{DeviceID}\n";
      print "DeviceSpecificPens: $objItem->{DeviceSpecificPens}\n";
      print "DitherType: $objItem->{DitherType}\n";
      print "DriverDate: $objItem->{DriverDate}\n";
      print "DriverVersion: $objItem->{DriverVersion}\n";
      print "ErrorCleared: $objItem->{ErrorCleared}\n";
      print "ErrorDescription: $objItem->{ErrorDescription}\n";
      print "ICMIntent: $objItem->{ICMIntent}\n";
      print "ICMMethod: $objItem->{ICMMethod}\n";
      print "InfFilename: $objItem->{InfFilename}\n";
      print "InfSection: $objItem->{InfSection}\n";
      print "InstallDate: $objItem->{InstallDate}\n";
      print "InstalledDisplayDrivers: $objItem->{InstalledDisplayDrivers}\n";
      print "LastErrorCode: $objItem->{LastErrorCode}\n";
      print "MaxMemorySupported: $objItem->{MaxMemorySupported}\n";
      print "MaxNumberControlled: $objItem->{MaxNumberControlled}\n";
      print "MaxRefreshRate: $objItem->{MaxRefreshRate}\n";
      print "MinRefreshRate: $objItem->{MinRefreshRate}\n";
      print "Monochrome: $objItem->{Monochrome}\n";
      print "Name: $objItem->{Name}\n";
      print "NumberOfColorPlanes: $objItem->{NumberOfColorPlanes}\n";
      print "NumberOfVideoPages: $objItem->{NumberOfVideoPages}\n";
      print "PNPDeviceID: $objItem->{PNPDeviceID}\n";
      print "PowerManagementCapabilities: " . join(",", (in $objItem->{PowerManagementCapabilities})) . "\n";
      print "PowerManagementSupported: $objItem->{PowerManagementSupported}\n";
      print "ProtocolSupported: $objItem->{ProtocolSupported}\n";
      print "ReservedSystemPaletteEntries: $objItem->{ReservedSystemPaletteEntries}\n";
      print "SpecificationVersion: $objItem->{SpecificationVersion}\n";
      print "Status: $objItem->{Status}\n";
      print "StatusInfo: $objItem->{StatusInfo}\n";
      print "SystemCreationClassName: $objItem->{SystemCreationClassName}\n";
      print "SystemName: $objItem->{SystemName}\n";
      print "SystemPaletteEntries: $objItem->{SystemPaletteEntries}\n";
      print "TimeOfLastReset: $objItem->{TimeOfLastReset}\n";
      print "VideoArchitecture: $objItem->{VideoArchitecture}\n";
      print "VideoMemoryType: $objItem->{VideoMemoryType}\n";
      print "VideoMode: $objItem->{VideoMode}\n";
      print "VideoModeDescription: $objItem->{VideoModeDescription}\n";
      print "VideoProcessor: $objItem->{VideoProcessor}\n";
      print "\n";
   }
}sub WMIDateStringToDate(strDate)
{
   return "blah";
}