First off let me say that I've been looking for something like
the code below which lists all processes running on a Win32 
machine for a bit.

But I've probed around with Data::Dumper and cannot see from the 
code below, how $Proc (a hashref) has entries for:

  $Proc->{ProcessID}
  $Proc->{Name}
  $Proc->{ExecutablePath}

As far as I can see, these keys do not exist in the hashref
of $Proc, but there's something going on here as indeed they
do produce exactly what they are named for.

Can someone explain this? What other information can we
extract from $Proc (other hidden keys)? Documentation?

--
Mike Arms


-----Original Message-----
From: Nguon, Vath [mailto:NguonV@;MTA.NET]
Sent: Thursday, November 07, 2002 1:17 PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: GetPID


The following Perl script was extracted from Dave Roth's Books. It should
run on Win2k machine.

==========================================================================
use Win32::OLE qw( in );

$Machine = ""; # Null string default to local machine

$CLASS = "WinMgmts:{impersonationLevel=impersonate}!//$Machine";

$WMI = Win32::OLE->GetObject($CLASS)
       || die "Unable to connect to \\$Machine". Win32::OLE->LastError();
           
$ProcList =  $WMI->InstancesOf("Win32_Process");
print
"\n*************************************************************************
**\n";
print " Running Processes on Server ".uc($Machine)."\n";
print
"***************************************************************************
\n\n";
foreach $Proc  (in( $ProcList )) {

   print $Proc->{ProcessID}."\t";
   print $Proc->{Name}."\t";
   print $Proc->{ExecutablePath}."\n";
  
}#foreach $proc
print
"\n*************************************************************************
**\n\n";
undef $ProcList;
print "\nEnd of program..\n";


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

Reply via email to