in reply to Re: Re: Re: Win32::Process::KillProcess
in thread Win32::Process::KillProcess

Hi again, I am obtaining the PID via Dave Roth's code from proclist.pl :
# WMI Win32_Process class $CLASS= "winmgmts:{impersonationLevel=impersonate}$machine\\Root\\cimv +2"; $WMI= Win32::OLE->GetObject($CLASS) || die; foreach my $process (sort {lc $a->{Name} cmp lc $b->{Name}} in($WMI->I +nstancesOf("Win32_Process"))) { if($process->{Name} eq 'GravitixService.exe' || $process->{ProcessID +} eq 'Gravitix.exe') { # Store the Gravitix process ID $pid= $process->{ProcessID}; } }
The PID ($pid) I get from this method is valid, I have verified that it is via a simple fkill on that PID.
But, the following scenarios still do not work i.e. the process remains up and no kill operation appears to go through. I am coding on a Windows 2003 machine :
kill method #1
my $x= Win32::Process::KillProcess($pid, $exitcode);
result -- nothing, process is not killed
value of $x = 26423748


kill method #2
my $y= Win32::Process::Open($p_obj, $pid, 0); $p_obj->Kill(0);
result -- nothing, process is not killed
value of $y= 0

I am at a loss as to WHY KillProcess is doing nothing in method #1, and in the case of method #2, why are Win32::Process:KillProcess and Win32::Process::Open both returning 0 ??

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Win32::Process::KillProcess
by Ninthwave (Chaplain) on Dec 23, 2003 at 21:54 UTC

    #2-open is returning failure noted by the value of zero.

    The Pen
    Follow Up
    If this is a remote machine Win32::Process::KillProcess only works locally.

    "No matter where you go, there you are." BB