I don't think Win32::OLE is strict safe.

take out the.....

use strict; 

I tested it here on my systems, and it returned what I think you are
looking for (software titles that were installed on the remote system.

Steven


________________________________

        From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
StoneBeat
        Sent: Monday, October 29, 2007 8:30 AM
        To: [email protected]
        Subject: WMI Problem
        
        
        Hi, Im triying to execute a remote WMI query with this script: 
        
        ------
        use strict;
        use warnings;
        use Win32::OLE qw( in );
        use Win32::OLE::Variant;
        
        use constant wbemFlagReturnImmediately => 0x10; 
        use constant wbemFlagForwardOnly => 0x20;
        use constant wbemFlagBidirectional => 0x0 ;
        
        $| = 1;
        
        Win32::OLE->Option(Warn => 100);
        
        
        my $locator =
Win32::OLE->CreateObject('WbemScripting.SWbemLocator ') or warn;
        
        my $service = $locator->ConnectServer("@ARGV[0]",
"root/CIMV2","@ARGV[1]", "@ARGV[2]") || die "ops error\n";
        
        my $colItems = $service->ExecQuery ('SELECT * FROM
CIM_Product',"WQL"); 
        
        
        foreach my $objItem (in $colItems)
        {
              print "Caption: $objItem->{Caption}\n";
              print "Description: $objItem->{Description}\n";
              print "Identifying Number:
$objItem->{IdentifyingNumber}\n"; 
              print "Name: $objItem->{Name}\n";
              print "Vendor: $objItem->{Vendor}\n";
              print "Version: $objItem->{Version}\n";
              print "\n";
        }    
        
        -----------
        
        
        When I execute this script I get ONLY one record and program
stops.
        
        Moreover ... when I try to use Win32_Product instead of
CIM_Product it returns nothing :=?
        
        
        
        
        
        


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to