Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Process mgmt on WinNT

by strat (Canon)
on Mar 13, 2002 at 13:15 UTC ( #151368=note: print w/replies, xml ) Need Help??


in reply to Process mgmt on WinNT

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"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://151368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-08-08 16:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?