cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
danielm
Champion Sweeper II

A simple way to see tasks on remote pcs and then kill them the lazy way

TASK LIST

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

{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.


@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

1 REPLY 1
danielm
Champion Sweeper II
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

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


Stop RR

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

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now