This will List processes.

#   ProcList.pl
#   -----------
#   This script will display the list of current processes along with
#   the process's PID and binary path.
#   Syntax:
#       perl ProcList.pl [Machine Name]
#
#   Examples:
#       perl ProcTree 
#       perl ProcTree.pl \\server 
#
#   2002.01.20 [EMAIL PROTECTED]
#
#   Permission is granted to redistribute and modify this code as long as 
#   the below copyright is included.
#
#   Copyright � 2002 by Dave Roth
#   Courtesty of Roth Consulting
#   http://www.roth.net/
use Win32::OLE qw( in );
use Win32::OLE::Variant;

$Machine = "\\\\.";
$Machine = shift @ARGV if( $ARGV[0] =~ /^\\\\/ );

# WMI Win32_Process class
$CLASS = "winmgmts:{impersonationLevel=impersonate}$Machine\\Root\\cimv2";
$WMI = Win32::OLE->GetObject( $CLASS ) || die;
foreach my $Proc ( sort {lc $a->{Name} cmp lc $b->{Name}} in( $WMI->InstancesOf( 
"Win32_Process" ) ) )
{
  printf( "% 5d) %s ", $Proc->{ProcessID}, "\u$Proc->{Name}" );
  print "( $Proc->{ExecutablePath} )" if( "" ne $Proc->{ExecutablePath} );
  print "\n";
}

*********** REPLY SEPARATOR  ***********

On 5/18/2004 at 8:45 AM Schichmanter, EithanX wrote:

>Hi,
>
> 
>
>I looked it up, and found the following:
>
> 
>
>use Win32::ToolHelp;
>  # --- prints names of all processes
>  my @ps = Win32::ToolHelp::GetProcesses();
>  foreach my $p (@ps)
>  { print $$p[8], "\n"; }
>
> 
>
> 
>
>Read more at:
>http://prantl.host.sk/perl/modules/Win32/ToolHelp/Win32-ToolHelp-0.2.htm
>l
>
> 
>
>Haven't tested it, though.
>
> 
>
>HTH
>
> 
>
> 
>
>All the best,
>
> 
>
>Schichmanter Eitan
>
>SDM Team Developer,
>
>Petah-Tikva, Israel
>
> 
>
>Intel(r) 
>
> 
>
>[EMAIL PROTECTED]
>
>phone: +972-3-9207046
>
>--------------------------------------------------------
>
> 
>
>Schichmanter Eitan,
>
>CM Consultant and Developer,
>
>LMB-Consulting LTD.
>
>[EMAIL PROTECTED]
>
>www.lmb.co.il
>
>  _____  
>
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Vitaly
>S.
>Sent: Monday, May 17, 2004 21:44
>To: [EMAIL PROTECTED]
>Subject: Seeking for a module to get list of all processes on
>win2k/XP(notNT or *unix)
>
> 
>
>hi all,
>I'm looking for a module, which could return the list (+ max available
>info) of all processes running on win2k/XP. Could you please point me to
>some existing and available module?
>
>I did found the one for winNT and on *unix systems it could be done by
>the recording and then parsed TOP command.
>
>appreciate the help,
>VS.




_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to