The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::WMIClient - Perl extension for WMI calls

SYNOPSIS

  use Net::WMIClient qw(wmiclient);
  ($rc, $ret_string) = wmiclient([HASHREF], LIST);

DESCRIPTION

This module provides a perl interface to libasync_wmi_lib, which implements the wmic binary as a Perl module. Returns the non-debug output as a string for parsing.

Functions

wmiclient([HASHREF], LIST)

Returns a true/false value to indicate success or failure, and the WMI output as a string, the same as calling `wmic <params> 2>&1`. In the event of an invalid output response, returns failure and the string "Invaild return value:" followed by the output enclosed in single quotes. Parameters may be passed in a hashref, a list, or both. The list parameter may be empty the hashref is provided. The hashref accepts the following entries:

    Timeout => <int>

    Sets a timeout after which the wmiclient call will abort and return a failure with the output 'TIMEOUT'. By default, the WMI client call will timeout after 60 seconds - setting this value will reduce that, but cannot increase it. This parameter is only available as part of the hashref, and cannot be set in list context.

    DebugLevel => <int>

    Equivalent to '-d N'. Note that debug output is NOT captured, and will be sent directly to STDOUT unless DebugStderr is also set.

    DebugStderr => <bool>

    If set to a true value, equivalent to '--debug-stderr'.

    ConfigFile => <string>

    Equivalent to '-s CONFIGFILE'.

    Option => <arrayref>

    Specifies an array of 'name=value' options to be set explicitly. Each entry in the array will be passed equivalent to '--option=name=value'.

    LogFileBase => <string>

    Equivalent to '-l LOGFILEBASE'.

    LeakReport => <bool>

    If set to a true value, equivalent to '--leak-report'.

    LeakReportFull => <bool>

    If set to a true value, equivalent to '--leak-report-full'.

    NameResolve => <string>

    Equivalent to '-R NAME-RESOLVE-ORDER'.

    SocketOpt => <string>

    Equivalent to '-O SOCKETOPTIONS'.

    NetBIOSName => <string>

    Equivalent to '-n NETBIOSNAME'.

    Workgroup => <string>

    Equivalent to '-W WORKGROUP'.

    Realm => <string>

    Equivalent to '--realm=REALM'.

    Scope => <string>

    Equivalent to '-i SCOPE'.

    MaxProtocol => <string>

    Equivalent to '-m MAXPROTOCOL'.

    Username => <string>

    Equivalent to '-U [DOMAIN/]USERNAME[%PASSWORD]'.

    NoPass => <bool>

    Equivalent to '-N'.

    Password => <string>

    Equivalent to '--password=STRING'.

    AuthFile => <string>

    Equivalent to '-A FILE'.

    Signing => [on|off|required]

    Equivalent to '-S [on|off|required]'.

    MachinePass => <bool>

    If set to a true value, equivalent to '-P'.

    SimpleBindDN => <string>

    Equivalent to '--simple-bind-dn=STRING'.

    Kerberos => <string>

    Equivalent to '-k STRING'.

    UseSecMech => <string>

    Equivalent to '--use-security-mechanisms=STRING'.

    Namespace => <string>

    Equivalent to '--namespace=STRING'.

    Delimiter => <string>

    Equivalent to '--delimiter=STRING'.

    Host => <string>

    Specifies the host to query. Can either be a plain host name, or //<hostname>.

    Query => <string>

    Specifies the WMI query to be sent to the host.

Options specified in both the hashref and array will be passed along, with parameters in the hashref overriding those in the array. The exception is that if multiple hosts are specified, or multiple queries, wmiclient will return an error.

Export

wmiclient

REQUIRED LIBRARIES

Requires libasync_wmi_lib.so.0 from the wmi package available at http://www.edcint.co.nz/checkwmiplus/wmi-1.3.14.tar.gz.

SEE ALSO

The wmic binary from the wmi package.

AUTHOR

Joshua Megerman, <josh@honorablemenschen.com<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Joshua Megerman

Portions Copyright by Jelmer Vernooij, Tim Potter, and Andrzej Hajda

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.