Kaseya Community

Script to kill a running process

  • Here is a small script to kill a running process on XP machines. W2k machines use tlist.exe instead.


    STEP 1...get the processes list.

    Script Name: Get Process List and Email Output
    Script Description: Email machine process list

    IF True
    THEN
    Get Variable
    Parameter 1 : 6
    Parameter 2 :
    Parameter 3 : machineid
    OS Type : 0
    Execute Shell Command
    Parameter 1 : tasklist.exe >> c:\tasklist.txt
    Parameter 2 : 0
    OS Type : 0
    Get Variable
    Parameter 1 : 1
    Parameter 2 : C:\tasklist.txt
    Parameter 3 : output
    OS Type : 0
    Send Email
    Parameter 1 : you@yourcompany.com
    Parameter 2 : tasklist on #machineid#
    Parameter 3 : #machineid# #output#
    OS Type : 0
    ELSE


    STEP 2.....Kill the process


    Script Name: Stop a Process
    Script Description: Stop a Process

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : taskkill.exe /f /im doscan.exe
    Parameter 2 : 0
    OS Type : 0
    ELSE

    .....OR you try this way


    Script Name: Stop a Process
    Script Description: Stop a Process

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : taskkill.exe /pid xxx
    Parameter 2 : 0
    OS Type : 0
    ELSE

    Legacy Forum Name: Script to kill a running process,
    Legacy Posted By Username: shickey
  • A simpler way would be to use either the 'Close Application' script function in kaseya or executing a shell command 'taskkill.exe processname' perhaps.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: XeviouS