Dear All,
I have a problem with WMI when I try to get all instances of a given class
(for example Win32_LogicalDisk). Once in a while it hang up when I try to
iterate over all instances.
This is my code:
sub gethard{
my ($host,$class,$user,$pass) = @_;
print "Getting installed hardware/software/configuration from $host :
$class\n" if $VERBOSE >= 4;
my $WMI = Win32::OLE->new('WbemScripting.SWbemLocator') or return undef;
my $Services = $WMI->ConnectServer($host,"root\\cimv2",$user,$pass)
or do{print ("erro: ($host,$user,$pass) -> $! \n"), Win32::OLE->LastError,
return undef};
print "Getting caracteristics\n" if $VERBOSE >= 4;
my $sys_set = $Services->InstancesOf($class) or return undef;
my %R;
my $i = 0;
my $obj = $WMICLASS{$class};
my @l = in $sys_set;
return undef if [EMAIL PROTECTED];
foreach my $comp (@l){
print "Getting values for object $i\n" if $VERBOSE >= 5;
next if $obj->{test} and not &{$obj->{test}}($comp);
foreach (@{$obj->{fields}}){
$R{$i}->{$_} = $comp->{$_};
}
$i++;
}
return \%R;
}
And it seems the problem is in line my @l = in $sys_set;
Sometimes, with some hosts, the call to in $sys_net never return. But I
found if I put another process running in parallel (not the same script but
a small baut with same WMI code lines) it will return work well and (more
strange) the first process immediately returns.
Does someone knows what is the problem? I already investigate WMI
documentation and deeply search the Net to see if there are any problems
reported and related to this matter, but until know I don't found anything.
Thank you in advance
Isidro Vila Verde
Serprest (http://serprest.pt/)
[EMAIL PROTECTED]
TEL: +351 223 743 701
GSM:+351 969 103 006
FAX: +351 223 743 703
A presente mensagem pode conter informa��o considerada confidencial. Se o
receptor desta mensagem n�o for o destinat�rio indicado, fica expressamente
proibido de copiar ou endere�ar a mensagem a terceiros. Em tal situa��o, o
receptor dever� destruir a presente mensagem e por gentileza informar o
emissor de tal facto.
Privileged or confidential information may be contained in this message. If
you are not the addressee indicated in this message, you may not copy or
deliver this message to anyone. In such case, you should destroy this
message and kindly notify the sender by reply email.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs