Win32::Process::Info::WMI - Provide process information via WMI.


Win32-Process-Info documentation  | view source Contained in the Win32-Process-Info distribution.

Index


NAME

Top

Win32::Process::Info::WMI - Provide process information via WMI.

SYNOPSIS

Top

This package fetches process information on a given Windows machine, using Microsoft's Windows Management Implementation.

 use Win32::Process::Info
 $pi = Win32::Process::Info->new (undef, 'WMI');
 $pi->Set (elapsed_as_seconds => 0);	# In clunks, not seconds.
 @pids = $pi->ListPids ();	# Get all known PIDs
 @info = $pi->GetProcInfo ();	# Get the max

CAVEAT USER:

This package is not intended to be used independently; instead, it is a subclass of Win32::Process::Info, and should only be called via that package.

DESCRIPTION

Top

This package implements the WMI-specific methods of Win32::Process::Info.

The following methods should be considered public:

@info = $pi->GetProcInfo ();

This method returns a list of anonymous hashes, each containing information on one process. If no arguments are passed, the list represents all processes in the system. You can pass a list of process IDs, and get out a list of the attributes of all such processes that actually exist. If you call this method in scalar context, you get a reference to the list.

What keys are available depend both on the variant in use and the setting of b<use_wmi_names>. Assuming use_wmi_names is TRUE, you can hope to get at least the following keys for a "normal" process (i.e. not the idle process, which is PID 0, nor the system, which is PID 8) to which you have access:

    CSCreationClassName
    CSName (= machine name)
    Caption (seems to generally equal Name)
    CreationClassName
    CreationDate
    Description (seems to equal Caption)
    ExecutablePath
    KernelModeTime
    MaximumWorkingSetSize
    MinimumWorkingSetSize
    Name
    OSCreationClassName
    OSName
    OtherOperationCount
    OtherTransferCount
    Owner (*)
    OwnerSid (*)
    PageFaults
    ParentProcessId
    PeakWorkingSetSize
    ProcessId
    ReadOperationCount
    ReadTransferCount
    UserModeTime
    WindowsVersion
    WorkingSetSize
    WriteOperationCount
    WriteTransferCount

You may find other keys available as well.

* - Keys marked with an asterisk are computed, and may not always be present.

@pids = $pi->ListPids ();

This method lists all known process IDs in the system. If called in scalar context, it returns a reference to the list of PIDs. If you pass in a list of pids, the return will be the intersection of the argument list and the actual PIDs in the system.

REQUIREMENTS

Top

It should be obvious that this library must run under some flavor of Windows.

This library uses the following libraries:

  Carp
  Time::Local
  Win32::OLE
  use Win32::OLE::Const;
  use Win32::OLE::Variant;

As of ActivePerl 630, none of the variant libraries use any libraries that are not included with ActivePerl. Your mileage may vary.

ACKNOWLEDGMENTS

Top

This module would not exist without the following people:

Jenda Krynicky, whose "How2 create a PPM distribution" (http://jenda.krynicky.cz/perl/PPM.html) gave me a leg up on both PPM and tar distributions.

Dave Roth, http://www.roth.net/perl/, author of Win32 Perl Programming: Administrators Handbook, which is published by Macmillan Technical Publishing, ISBN 1-57870-215-1

AUTHOR

Top

Thomas R. Wyant, III (wyant at cpan dot org)

COPYRIGHT AND LICENSE

Top


Win32-Process-Info documentation  | view source Contained in the Win32-Process-Info distribution.