Notification

Icon
Error

Tasklist Task Kill action

Posted: Friday, March 30, 2012 1:07:27 AM(UTC)
danielm

danielm

Member Original PosterPosts: 187
1
Like
A simple way to see tasks on remote pcs and then kill them the lazy way

TASK LIST

Code:
cmd.exe /K {actionpath}pslist.exe -s -r 3 \\{computer}


The options set it to open a dos window and refresh every 3 seconds so you can see whats up.
pslist is from PStools kit you can get from microsoft at www.sysinternals.com


TASK KILL

Code:
{actionpath}taskkill.bat {computer}


the batch file would read. It just asks for the ID of the process or the name. allows repeat.
the NAMEOFSERVERHERE needs to be your server incase you do not have pskill locally :) i just put it on the lansweeper server share.

Code:

@echo off
if %1.==. GOTO END

:STARTOFKILL
ECHO.
@ECHO Preparing to kill Process on computer %1
REM Clearing variables
set killprocess=
set killagain=
set idkill=

ECHO.
set /p killprocess=Do you wish to kill a process (n/y) [enter=skip]?
if {%killprocess%}=={y} goto yeskill
if {%killprocess%}=={n} goto nokill
if %killprocess%.==. goto nokill
goto nokill
:yeskill
set /p idkill=Enter number only of ID to delete [process name or process id]?
\\NAMEOFSERVERHERE\lansweeper$\pskill.exe \\%1 %idkill%

set /p killagain=Do you wish to kill another process (n/y) [enter=skip]?
if {%killagain%}=={y} goto STARTOFKILL
if {%killagain%}=={n} goto noagainkill
:noagainkill

:nokill

ECHO.
ECHO Press any key to close this window...
pause>nul

GOTO END

:BLANK
:END

danielm
#1danielm Member Original PosterPosts: 187  
posted: 1/19/2018 10:36:17 PM(UTC)
Also to add,
I noticed after some time the commands stopped working on some remote machines. the pslist and such would return an error.
in any case I was able to solve them like this. Mainly I think it's due to remote registry not being on, which you may not want on all the time...
I am just doing it multiple times bellow for informative purposes so you know if its on or off. But, you could just do the start and stop if you do not care about verification.

so

Start_RR
Code:

cmd /K sc \\{smartname} query remoteregistry & sc \\{smartname} start remoteregistry & sc \\{smartname} query remoteregistry & pause & exit


Stop RR
Code:

cmd /K sc \\{smartname} query remoteregistry & sc \\{smartname} stop remoteregistry & sc \\{smartname} query remoteregistry & pause & exit

Active Discussions

Lansweeper Upgrade Win 10 build to version 2004
by  CyberCitizen   Go to last post Go to first unread
Last post: Today at 12:11:55 AM(UTC)
Lansweeper Sort Reports by Last Changed
by  LANGuy  
Go to last post Go to first unread
Last post: Yesterday at 7:02:23 PM(UTC)
Lansweeper Windows Encryption Method
by  elKastr0nom   Go to last post Go to first unread
Last post: Yesterday at 6:02:07 PM(UTC)
Lansweeper Built in report - AD Password Expired
by  FezUSA  
Go to last post Go to first unread
Last post: Yesterday at 3:12:17 PM(UTC)
Lansweeper Helpdesk Dashboard Shared Tab
by  mark chamberlain   Go to last post Go to first unread
Last post: Yesterday at 2:32:20 PM(UTC)
Lansweeper Uninstall an software with Password
by  CyberCitizen   Go to last post Go to first unread
Last post: Yesterday at 6:20:28 AM(UTC)
Lansweeper Scanning for Events in Applications and Services Logs
by  Geoff P G  
Go to last post Go to first unread
Last post: 10/20/2021 5:22:11 PM(UTC)