CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Checking for taskmgr.exe whether its running or no and if its running log its memory utilization

 



Amitk
Novice

Feb 17, 2013, 8:13 AM

Post #1 of 1 (10111 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/^/;

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives