D
Daniel Berger
Hi all,
A.S. Perl 5.8.1
Windows 2000
I noticed that when using Win32::OLE + WMI, the boolean return values
from the Win32_Processor class return undef instead of a value.
Relevant link (select Win32_Processor on the left frame):
http://msdn.microsoft.com/library/d...isdk/wmi/computer_system_hardware_classes.asp
Example code:
use strict;
use Sys::Hostname;
use Win32::OLE qw(in);
my $host = hostname();
my $cs = "winmgmts://$host/root/cimv2";
my $wmi = Win32::OLE->GetObject($cs);
my $cpu_set = $wmi->InstancesOf("Win32_Processor");
foreach my $cpu(in($cpu_set)){
print "Name: [", $cpu->{'Name'}, "]\n";
print "Error Code: [", $cpu->{'ConfigManagerErrorCode'}, "]\n";
print "Description: [", $cpu->{'Description'}, "]\n";
print "Error Cleared?: [", $cpu->{'ErrorCleared'}, "]\n";
}
# Output:
Name: [AMD Athlon(tm) XP 2800+]
Error Code: []
Description: [x86 Family 6 Model 10 Stepping 0]
Error Cleared?: []
The ConfigManagerErrorCode and ErrorCleared attributes (among others)
are of type boolean. I would expect a 0 or 1 for these attributes,
not undef. Or is it understood that undef == false? Or is a WMI
issue? I didn't see anything in the Win32::OLE docs that specifically
mentioned this.
Regards,
Dan
A.S. Perl 5.8.1
Windows 2000
I noticed that when using Win32::OLE + WMI, the boolean return values
from the Win32_Processor class return undef instead of a value.
Relevant link (select Win32_Processor on the left frame):
http://msdn.microsoft.com/library/d...isdk/wmi/computer_system_hardware_classes.asp
Example code:
use strict;
use Sys::Hostname;
use Win32::OLE qw(in);
my $host = hostname();
my $cs = "winmgmts://$host/root/cimv2";
my $wmi = Win32::OLE->GetObject($cs);
my $cpu_set = $wmi->InstancesOf("Win32_Processor");
foreach my $cpu(in($cpu_set)){
print "Name: [", $cpu->{'Name'}, "]\n";
print "Error Code: [", $cpu->{'ConfigManagerErrorCode'}, "]\n";
print "Description: [", $cpu->{'Description'}, "]\n";
print "Error Cleared?: [", $cpu->{'ErrorCleared'}, "]\n";
}
# Output:
Name: [AMD Athlon(tm) XP 2800+]
Error Code: []
Description: [x86 Family 6 Model 10 Stepping 0]
Error Cleared?: []
The ConfigManagerErrorCode and ErrorCleared attributes (among others)
are of type boolean. I would expect a 0 or 1 for these attributes,
not undef. Or is it understood that undef == false? Or is a WMI
issue? I didn't see anything in the Win32::OLE docs that specifically
mentioned this.
Regards,
Dan