I'm always getting the same values they don't change...my $class = "Win32_PerfFormattedData_PerfOS_Processor"; my $key = 'Name'; # CORRECTION: user feedback BrowserUK my @properties = qw(PercentIdleTime PercentProcessorTime PercentPr +ivilegedTime PercentUserTime PercentInterruptTime); my $wmi = Win32::OLE->GetObject("winmgmts://./root/cimv2") or die "Failed getobject\n"; my $list, my $v; $list = $wmi->InstancesOf("$class") or die "Failed getobject\n"; foreach $v (in $list) { $hash->{$v->{$key}}->{$_} = $v->{$_} for @properties; } print Dumper $hash;
Here's the output:
What am i doing wrong?$VAR1 = { '0' => { 'PercentPrivilegedTime' => '0', 'PercentIdleTime' => '0', 'PercentInterruptTime' => '0', 'PercentUserTime' => '0', 'PercentProcessorTime' => '100' }, '_Total' => { 'PercentPrivilegedTime' => '0', 'PercentIdleTime' => '0', 'PercentInterruptTime' => '0', 'PercentUserTime' => '0', 'PercentProcessorTime' => '100' } };
Tks in advance,
gulden
In reply to How to GET CPU values from WMI by gulden
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |