Win32_PnPSignedDriver perl sample code | ActiveXperts Network Monitor
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_PnPSignedDriver WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Sample Code
use strict;
use Win32::OLE('in');
use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;
my @computers = ("\localhost");
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_PnPSignedDriver", "WQL",
wbemFlagReturnImmediately | wbemFlagForwardOnly);
foreach my $objItem (in $colItems) {
print "Caption: $objItem->{Caption}\n";
print "ClassGuid: $objItem->{ClassGuid}\n";
print "CompatID: $objItem->{CompatID}\n";
print "CreationClassName: $objItem->{CreationClassName}\n";
print "Description: $objItem->{Description}\n";
print "DeviceClass: $objItem->{DeviceClass}\n";
print "DeviceID: $objItem->{DeviceID}\n";
print "DeviceName: $objItem->{DeviceName}\n";
print "DevLoader: $objItem->{DevLoader}\n";
print "DriverDate: $objItem->{DriverDate}\n";
print "DriverName: $objItem->{DriverName}\n";
print "DriverProviderName: $objItem->{DriverProviderName}\n";
print "DriverVersion: $objItem->{DriverVersion}\n";
print "FriendlyName: $objItem->{FriendlyName}\n";
print "HardWareID: $objItem->{HardWareID}\n";
print "InfName: $objItem->{InfName}\n";
print "InstallDate: $objItem->{InstallDate}\n";
print "IsSigned: $objItem->{IsSigned}\n";
print "Location: $objItem->{Location}\n";
print "Manufacturer: $objItem->{Manufacturer}\n";
print "Name: $objItem->{Name}\n";
print "PDO: $objItem->{PDO}\n";
print "Signer: $objItem->{Signer}\n";
print "Started: $objItem->{Started}\n";
print "StartMode: $objItem->{StartMode}\n";
print "Status: $objItem->{Status}\n";
print "SystemCreationClassName: $objItem->{SystemCreationClassName}\n";
print "SystemName: $objItem->{SystemName}\n";
print "\n";
}
}sub WMIDateStringToDate(strDate)
{
return "blah";
}
