natty_dread has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Win32::OLE; my $refWMI = Win32::OLE->GetObject("winMgmts:"); ###### Get Processes mins. my $strQuery = "Select * FROM Win32_Process WHERE Name='mspaint.exe'"; my $colProcesses1 = $refWMI->ExecQuery ($strQuery); foreach my $refPS (in $colProcesses1) { print $refPS->{Name} . " is running \n"; sleep (5); $refPS->Terminate(); } undef $colProcesses1; undef $refWMI;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: killing processes w/WMI
by Anonymous Monk on Dec 03, 2004 at 13:36 UTC | |
by hsinclai (Deacon) on Dec 03, 2004 at 14:12 UTC |