natxo has asked for the wisdom of the Perl Monks concerning the following question:
------------------------------------------------------ and this is what I get:--------------------------script--------------- #!/usr/bin/perl use warnings; use strict; use Win32::OLE; my $WMIServices; my $Namespace = "\\root\\cimv2"; my $Machine = "."; my @files; my $strdate = "20031102000000.000000+000"; my $query = "Select * From CIM_DataFile Where CreationDate < '$strdate +' and drive = 'C:'"; print $query . "\n"; my $object = "winmgmts:\\\\$Machine$Namespace"; print $object . "\n"; $WMIServices = Win32::OLE->GetObject("$object"); @files = $WMIServices->ExecQuery("$query"); foreach (@files) { print "$_\n"; }
Apparently I get the wmi statement ok, and the object too, but what under vbs works fine, under perl does not. I must be the cause, but I do not see it. Any ideas? thanks in advanceH:\scripts\perl\win32> perl wmi2.pl Select * From CIM_DataFile Where CreationDate < '20031102000000.000000 ++000' and drive = 'C:' winmgmts:\\.\root\cimv2 Win32::OLE=HASH(0x1986408)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: win32 wmi question
by Corion (Patriarch) on Nov 16, 2006 at 22:59 UTC |