
Amitk
Novice
Feb 17, 2013, 8:13 AM
Post #1 of 1
(20791 views)
|
Checking for taskmgr.exe whether its running or no and if its running log its memory utilization
|
Can't Post
|
|
Dear all, I want to do Checking for taskmgr.exe whether its running or no and if its running log its memory utilization. I found the script which will print all the processes which are running, can someone help me to just print taskmgr.exe out of it and its memory utilization as well. Pasting script for your reference use warnings; use strict; use Win32::OLE qw(in); sub matching_processes { my($pattern) = @_; my $objWMI = Win32::OLE->GetObject('winmgmts://./root/cimv2'); my $procs = $objWMI->InstancesOf('Win32_Process'); my @hits; foreach my $p (in $procs) { push @hits => [ $p->Name, $p->ProcessID ] if $p->Name =~ /$pattern/; } wantarray ? @hits : \@hits; } print $_->[0], "\n" for matching_processes qr/^/; #print $_->[1], "\n" for matching_processes qr/^/;
|