Hi.
StoneBeat wrote:
>
> D:\UME\tudimelo>perl software.pl remotehost administrador password
> Caption: Producto de sistema informßtico
> Description: Producto de sistema informßtico
> Identifying Number: GB8724JDMK
> Name: ProLiant DL360 G5
> Vendor: HP
> Version: <undef>
>
>
> D:\UME\tudimelo>
>
> As you can see, only shows one record, dont know why
>
> 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";
>
As Daniel said in a different note, "@ARGV[0]", etc. is better written
as "$ARGV[0]"
>
> my $colItems = $service->ExecQuery ('SELECT * FROM
> CIM_Product',"WQL");
>
According to the docs ->
http://msdn2.microsoft.com/en-us/library/aa392770.aspx ExecQuery's
second argument is a long. I'm not sure what "WQL" does here. Perhaps
you meant something like:
my $WQL = wbemFlagReturnImmediately | wbemFlagForwardOnly # or whatever
flags are needed...
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";
> }
>
>
> 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