Tom Wyant > Win32-Process-Info > Win32::Process::Info::WMI

Download:
Win32-Process-Info-1.020.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Stalled  1
View/Report Bugs
Module Version: 1.020   Source  

NAME ^

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

SYNOPSIS ^

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 ^

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

This package returns Windows process IDs, even under Cygwin.

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 ^

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 ^

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 ^

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

COPYRIGHT AND LICENSE ^

Copyright (C) 2001-2005 by E. I. DuPont de Nemours and Company, Inc.

Copyright (C) 2007, 2010-2011, 2013 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

syntax highlighting: