I think, Win32::Process just helps you if you've started this Process with Win32::Process...
For fetching Win32-Processes, there are several possibilities, e.g.
#!perl -w
use strict;
use Win32::OLE qw(in);
#Mode: Window Management Instrumentation (WMI)
# processproperties
my @properties = qw(Caption CreationClassName CreationDate CSCreationC
+lassName
CSName Description ExecutablePath ExecutionState Handle
HandleCount InstallDate KernelModeTime MaximumWorkingSetSi
+ze
MinimumWorkingSetSize Name OSCreationClassName OSName
OtherOperationCount OtherTransferCount PageFaults PageFile
+Usage
ParentProcessId PeakPageFileUsage PeakVirtualSize PeakWork
+ingSetSize
Priority PrivatePageCount ProcessId QuotaNonPagedPoolUsage
QuotaPagedPoolUsage QuotaPeakNonPagedPoolUsage QuotaPeakPa
+gedPoolUsage
ReadOperationCount ReadTransferCount SessionId Status Term
+inationDate
ThreadCount UserModeTime VirtualSize WindowsVersion Workin
+gSetSize
WriteOperationCount WriteTransferCount);
# processmethods
my @methods = qw(Create Terminate GetOwner GetOwnerSid);
my $server = ''; # local machine
my $locatorObj = Win32::OLE->new('WbemScripting.SWbemLocator')
or die ("Error in creating locator object: ".Win32::OLE->LastError
+()."\n");
$locatorObj->{Security_}->{impersonationlevel} = 3;
my $serverObj = $locatorObj->ConnectServer($server, 'root\cimv2')
or die ("Error in creating server object: ".Win32::OLE->LastError(
+)."\n");
my $procSchema = $serverObj->Get('Win32_Process');
#@properties = map{ $_->{Name} } (in $procSchema->{Properties_});
#@methods = map{ $_->{Name} } (in $procSchema->{Methods_});
foreach my $process (in $serverObj->InstancesOf("Win32_Process")){
foreach (@properties){
printf ("'%20s' => '%s'\n", $_, $process->{$_} || '' );
}
print ("-----------------------------------------------\n");
}
or use: tlist.exe or pstat.exe from WinNT-Reskit
Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print" |