Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Killing processes

Status
Not open for further replies.

Zippeh

Programmer
Sep 24, 2002
56
GB
Hi there!

I'm writing a script that is supposed to kill a single process if the memory usage gets too big. I'm using the Win32::OLE library to do it.

Thing is, the process I want to kill is running as a different user to what the script will be running as. Is there any way I can kill this process?

Here is the code I have been using (well a small bit of it):

Code:
  $objWMIProcess = Win32::OLE->GetObject('winmgmts:\\\\.\\root\\cimv2:Win32_Process.Handle=\'' . $intMaxPID . '\'');
  $intRC = $objWMIProcess->Terminate();
 
In windows as long as the user has administrative rights it can kill "almost" any process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top