Thread WindowsNT Prozesse ? (3 answers)
Opened by BrownWolf at 2003-12-27 03:18

Strat
 2003-12-27 22:24
#77035 #77035
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!perl -w
use strict;
use Win32::OLE qw(in);

#Mode: Window Management Instrumentation (WMI)

# processproperties
my @properties = qw(Caption CreationClassName CreationDate CSCreationClassName
CSName Description ExecutablePath ExecutionState Handle
HandleCount InstallDate KernelModeTime MaximumWorkingSetSize
MinimumWorkingSetSize Name OSCreationClassName OSName
OtherOperationCount OtherTransferCount PageFaults PageFileUsage
ParentProcessId PeakPageFileUsage PeakVirtualSize PeakWorkingSetSize
Priority PrivatePageCount ProcessId QuotaNonPagedPoolUsage
QuotaPagedPoolUsage QuotaPeakNonPagedPoolUsage QuotaPeakPagedPoolUsage
ReadOperationCount ReadTransferCount SessionId Status TerminationDate
ThreadCount UserModeTime VirtualSize WindowsVersion WorkingSetSize
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");
}
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/

View full thread WindowsNT Prozesse ?