Search code examples
windowspython-2.7processoperating-systemadmin-rights

Stop process/program without admin rights - python


Is it possible to end/stop/pause/freeze a process/program running in background with python without having administrator rights on a Windows 7/8/10? If yes how? If no why?


Solution

  • If it is yours, you can. Read about taskkill, taskmgr and wmic. Call them using os.system. Also, you may use os.kill, like:

    os.kill (your-process-id, signal.SIGKILL)             
    

    (determining process ID requires reading process table, either parsing tasklist output or doing it via API)

    If it is not yours, sorry... It means you should not kill it. But always, there is a way to kill the process - shut down the computer.