I oftenly faced the issue that my VNC-Server is frozen.
So I've written small script using NCat (from NMap) that checks, whether the server is still responding, and restarts it if necessary:
Code: Select all
@echo off SETLOCAL ENABLEDELAYEDEXPANSION REM newer versions of NCAT can be found here: https://nmap.org/download.html REM XP-compatible version is here: https://nmap.org/dist/nmap-6.47-win32.zip set netcat=R:\Programme\DOS\nmap-6.47\ncat.exe set outfile="out.txt" set vncserver="D:\Programme\UltraVNC\winvnc.exe" del %outfile% set found=0 FOR /F "delims=" %%A IN ('echo Hello ^| %netcat% -4 -i 1 127.0.0.1 5900 -o out.txt') DO ( REM for each line if "%%A"=="RFB 003.008" ( set found=1 ) echo line: %%A echo found: !found! ) echo found final: %found% echo. if %found%==1 ( echo UltraVNC-Server is responding correctly ==^> do nothing and exit goto :end ) else ( echo UltraVNC-Server doesn't respond ==^> Restart it: echo Taskkilling: TaskKill /F /IM winvnc.exe echo Restarting: start "" %vncserver% echo %DATE% %TIME% restarted UltraVNC-Server >> UVNC-Restart-Log.txt ) :end echo EXIT REM win10 only: timeout /T 600 REM if existing: REM warten.exe 600000 REM if not: REM ping 127.0.0.1 -n 600 > NUL REM this just keeps the cmd window open for a bit so you might find it when connecting.
The script is properly running on a XP machine. The testing part can also work with Win10 (or any in between). However, you might have to modify the start "" %vncserver% line (to start for the correct user) and/or give the script admin privileges to kill the running+frozen winvncs.exe.