eval
{
local $SIG{ALRM} = sub { warn "ALARM FOR GET WMIC L: \"" . __LINE__ . "\" F: \"" . __FILE__ . "\"\n" }; # NB: \n required
alarm 10;
$wmicon = Win32::OLE->GetObject('winmgmts:' . '{impersonationLevel=impersonate, authenticationLevel=pkt}!\\\\' . $host . '\\root\\CIMV2\sms')
or $ok = 0;
alarm 0;
};
if($@){ $err = 1; $ret = "timeout while accessing wmi on machine $host"; return($err, $ret); }
else { } # didn't
####
$col = undef;
eval
{
local $SIG{ALRM} = sub { warn "ALARM FOR GET EXEC QUERY: \"$query\" L: \"" . __LINE__ . "\" F: \"" . __FILE__ . "\"\n" }; # NB: \n required
alarm 5;
$col = $wmicon->ExecQuery($query, "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly | WbemAuthenticationLevelPkt)
or $ok = 0;
alarm 0;
};
if($@){ $err = 1; $ret = "timeout while QUERY: \"$query\" wmi on machine $host"; return($err, $ret); }
else { } # didn't
if($ok == 0) { $err = 1; $ret = clean(Win32::OLE->LastError); return($err, $ret); }
####
$objct = 0; $enabled = 0;
$obj = undef;
foreach $obj (in $col)
{
my $delete = 0;
if($debug == 1) { print "\tOBJ: \"$obj\" L: \"" . __LINE__ . "\"\n"; }
}
####
my %colhash = % { $col };
if($debug == 1) { print "DUMP COLHASH: \"" . Dumper(%colhash) . "\" L: \"" . __LINE__ . "\"\n"; }