The IndexWhat's changed on DarkAge.co.ukDownload fastpush and other toolsFrequently asked questionsHow to... do thingsSupport for old versions of WindowsNews & noise!Drop me a lineGet me outta here!

Terminate a crashed VNC session remotely


Overview

In life there are three things that are certain: death, taxes and a program crashes. WinVNC is a very stable program, but you can knock it over. Slow WAN links or trying to run tight compression on a slow PC can cause problems.

If WinVNC crashes, it will bring up a Dr Watson error and this prevents you from simply restarting the service (thanks Watson).

Requirements

If you have a the Sysinternals' PSKILL tool - you can get WinVNC back up and running again. You will need pskill and pslist. Both of which are available under the NT/2000 freeware tools section. (NB: The web site has a lot of interesting tools and I'd recommend a good look around).

Steps

    1. Firstly you'll need administrator level access to the remote machine. So, either you use your admin account, or do a net use \\remotebox\ipc$ /user to get a link going.

    2. Use SC to stop the service (sc \\machine stop winvnc) and then check it's status (sc \\machine query winvnc).

    3. Then, run pslist \\machinename to get a list of the processes. Look down the side for DrWtsn (or something like that) and the process number. Now, use pskill \\machine xxx where xxx is the process number of the (evil) Dr Watson.

    4. Wait for pskill to do it's work and then try SC \\machine start winvnc. Check WinVNC's status by using sc \\machine query winvnc. If it's started - give VncViewer another whirl.

Alternatively

This quick and dirty cmd file will do the job too. Use it as "filename targetmachinename <enter>".

@echo off
set watson=

for /f "tokens=1,2*" %%A in ('pslist \\%1 drwtsn32') do @set watson=%%B
if NOT "%watson%"=="drwtsn32" goto killwatson
if "%watson%"=="drwtsn32" echo No DrWatson process found on NT box "%1". 
goto end

:killwatson
Echo Killing Dr Watson Error and restarting WinVNC service, please wait.
pskill \\%1 %watson%
sc \\%1 start winvnc
:end

Save that script to a cmd file and run it with admin rights.