Important: Please read the Qt Code of Conduct -

Kill the process for a remote computer by Python in QT

  • Dear All,
    I have designed an application by PYQT5 and python 3.6 to kill the process in localhost by write the process name in 'lineEdit' as below in the code then hit 'kill' button to kill it.

    What I want is to kill the process in remote computer by fetching the data first then check the name of the process that I want to kill then BOOM!.

    Any ideas?

    The code below to kill the process in localhost only NOT in the remote PC.

    def Process(self):
            for proc in psutil.process_iter():
                    QMessageBox.information(self, "Success", x + " has been terminated")
            for proc in psutil.process_iter():
                    QMessageBox.information(self, "Error","The process " +x + " is not found")

    The code below to kill the process in remote PC by using batch file, however, is not showing in textBrowser in QT just showing in Pycharm editor,

    def kill_process(self):

    The batch file (rp.bat),

    @echo off
    set /p comp=Please put the computer name:
    wmic /node:%comp% process where name="thunderbird.exe" call terminate >>nul

    Thanks in advance,

  • I've done this, but doing it well is a lot more complicated than you might think. You need to consider:

    1. communications channel to client machine
    2. encryption/security
    3. authoritative inquiry about the remote task you're killing
    4. adequate privilege to carry out the terminate operation

    These issues are more complicated if you are in a heterogenous OS environment: linux, windows, mac, embedded, etc.

  • @monamour Read the documentation or use QProcess (and read the documentation).

Log in to reply