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):
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();