Win32::WQL - DBI-like wrapper for the WMI
use Win32::WQL; my $wmi = Win32::WQL->new( machine => 'remote_computer' ); my $sth = $wmi->prepare(<<'WQL'); ASSOCIATORS OF {Win32_Directory.Name='C:\\WINNT'} WHERE ResultClass = CIM_DataFile WQL my $remote_files = $sth->execute; while (my $file = $remote_files->fetch()) { print $file->{Name},"\n"; };
This module implements a bare bones DBI clone which is similar yet different. You will most likely want to use the real thing, DBD::WMI, which is a compatibility layer over this module.
new %ARGS
Initializes the thin wrapper over the Win32::OLE WMI instance. All parameters are optional.
machine
The parameter is the machine name to connect to. It defaults to the local machine.
wmi
A preinitialized WMI object to use. Defaults to creating a fresh instance.
statement_class
The class into which the results of prepare are blessed. Defaults to Win32::WQL::Statement.
prepare
Win32::WQL::Statement
event_iterator_class
The class into which the results of fetchrow are blessed for event queries. Defaults to Win32::WQL::Iterator::Event.
fetchrow
Win32::WQL::Iterator::Event
collection_iterator_class
The class into which the results of fetchrow are blessed for static queries. Defaults to Win32::WQL::Iterator::Collection.
Win32::WQL::Iterator::Collection
$wmi->prepare QUERY
Returns a prepared query by calling
return $self->statement_class->new({ query => $query, wmi => $self, iterator_class => $class, wmi_method => $method, });
$wmi->event_query QUERY
Determines whether a query is an event query or a static query.
Event queries return a row whenever a new event arrives and block if there is no event available.
Static queries are static and return all rows in one go.
A query is considered an event query if it matches
$query =~ /\b__instance(?:\w+)event\b/i or $query =~ /\wEvent\b/i
DBD::WMI for more examples
Implement parameters for and credentials
Implement a multiplexer by using multiple, waiting threads so you can SELECT events from more than one WMI namespace
SELECT
The public repository of this module is https://github.com/Corion/dbd-wmi.
The public support forum of this module is https://perlmonks.org/.
Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-WMI or via mail to www-mechanize-phantomjs-Bugs@rt.cpan.org.
Max Maischein corion@cpan.org
corion@cpan.org
Copyright 2009-2018 by Max Maischein corion@cpan.org.
This module is released under the same terms as Perl itself.
To install DBD::WMI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBD::WMI
CPAN shell
perl -MCPAN -e shell install DBD::WMI
For more information on module installation, please visit the detailed CPAN module installation guide.