Kill a process running under SYSTEM account in the Windows Server

kill-processwindowswindows-server-2008-r2windows-service

I have a server with Windows Server 2008 R2 and a service process (our custom service) running on it under SYSTEM account. A service has presumably hanged and I wanted to stop it. I tried stopping via Management Console "Services" snap-in, but it didn't help, service process still running, despite in the Management Console it is already marked as not running. Is there a way to kill it from the command line? Note that service runs under the SYSTEM account. I have full administrative privileges on the server.

I have tried pskill from console with elevated privileges (just as pskill PID), but it didn't do the job: it has reported that process killed, but I still see it in the Task Manager.

Taskkill also doesn't help:

C:\>taskkill /f /im myservice.exe
ERROR: The process "myservice.exe" with PID 1268 could not be terminated.
Reason: There is no running instance of the task.

But the process still visible in the Task Manager.

Update:
Powerhell Stop-Process -Name myservice -Force also didn't work.

Any ideas how to really kill the process (except rebooting the server)?

Best Answer

Download pstools and extract the downloaded zip file. There will be an exe file with name psexec.

open cmd.exe/command prompt with run as admin option. There you type below command. "psexec.exe /s /i cmd.exe"

It will launch one more console window with system user as current user. From there you can run whatever commands you want with system user access