ntvnc.bat :
========================================================================@echo off
REM *** Developed by John Blyth, Carnarvon, Western Australia (jblyth@cheerful.com)
REM *** With Francis Vivat, France (francis.vivat@cetp.ipsl.fr)
REM *** PLEASE LET US KNOW OF ANY IMPROVEMENTS/SUGGESTIONS!!
REM *** Next 3 lines generate result files if needed - (if not using NTBatchVNC.bat)
if not exist success.txt echo WinVNC Sucessfully Installed > success.txt
if not exist error.txt echo Computers not Found > error.txt
if not exist Previous.txt echo Current Version Previously Installed - Not Updated > Previous.txt
cls
REM *** DON'T FORGET TO EDIT THE SET COMMANDS:
REM *** Server being used to supply registry settings and files:
set serv=\\pc-image
REM *** Directory on server to get WinVNC from:
set VNCfile="%serv%\c$\winnt\system32"
REM *** NT Directory on Remote PC:
for /F "tokens=2 delims=\" %%i in ('reg query "hklm\software\microsoft\windows nt\currentversion\systemroot" \\%1') do set sysroot=%%i
REM *** Version Number for WinVNC:
set version=3.3.3
REM *** DON'T EDIT THESE SET COMMANDS:
set Destfile=\\%1\c$\%sysroot%\system32
set servicepath=c:\%sysroot%\system32\winvnc.exe
echo Server = %Serv%
echo Server Program Directory = %VNCFile%
echo Version Checker Set to = %Version%
if "%1" == "" goto ExitInst
echo Destination for Files = %Destfile%
echo Path to Service = %Servicepath%
if not exist %destfile%\*.exe goto ExitErr
REM *** CHECKS VERSION. DOES NOT UPGRADE UNLESS UPGRADE IN THE COMMAND LINE WHEN NOT USING NTBatchVNC.BAT:
reg query hklm\software\orl\vnc\%version% %1
if errorlevel 2 goto Upgrade
if errorlevel 0 goto current
:current
echo Version %version% Installed
echo.
if "%2" == "upgrade" goto Upgrade
echo WinVNC %version% for %1 already Installed
echo WinVNC %version% for %1 already Installed >> Previous.txt
goto exit
:Upgrade
echo Please Wait ...
if "%2" == "upgrade" echo Upgrading Now
echo Stopping WinVNC Service
echo -----------------------
sc \\%1 stop winvnc
echo.
echo Removing WinVNC Service
echo -----------------------
sc \\%1 delete WinVNC
echo.
echo Removing Previous Version
echo -------------------------
del \\%1\c$\%sysroot%\system\omnithread_rt.dll
del \\%1\c$\%sysroot%\system\vnchooks.dll
del \\%1\c$\%sysroot%\system\winvnc.exe
del \\%1\c$\%sysroot%\system\iplist.txt
del %Destfile%\omnithread_rt.dll
del %Destfile%\vnchooks.dll
del %Destfile%\winvnc.exe
del %Destfile%\iplist.txt
echo.
echo Loading New Version
echo -------------------
copy %VNCFile%\winvnc.exe %Destfile%
copy %VNCFile%\omnithread_rt.dll %Destfile%
copy %VNCFile%\vnchooks.dll %Destfile%
echo.
echo Replacing Registry Settings
echo ---------------------------
set CLE=HKLM\Software\ORL
reg DELETE %CLE% \\%1 /FORCE
reg COPY %CLE% %Serv% %CLE% \\%1
set CLE=HKLM\Software\Microsoft\Windows\CurrentVersion\Run\WinVNC
reg DELETE %CLE% \\%1 /FORCE
reg ADD %CLE%="winvnc.exe -servicehelper" \\%1
echo.
echo Installing WinVNC Service
echo -------------------------
sc \\%1 create WinVNC binpath= "%servicepath% -service" type= own type= interact start= auto
echo.
echo Starting WinVNC Service
echo -----------------------
sc \\%1 start winvnc
echo.
echo WinVNC Installed to %1
echo WinVNC Installed to %1 >> success.txt
echo.
goto exit
:ExitErr
Echo.
Echo.
Echo ERROR ! - Computer %1 Not Found......
echo ERROR ! - Computer %1 Not Found...... >> error.txt
echo.
echo.
goto exit
:ExitInst
Echo.
Echo USAGE - NTVNC Computername [upgrade]
Echo (upgrade : If required -FORCES UPGRADE)
Echo ex : NTVNC pc-nt4
Echo ex : NTVNC pc-nt4 upgrade
Echo.
Pause
echo.
:Exit
========================================================================
ntbatchvnc.bat :
========================================================================
@echo off
REM *** Developed by John Blyth, Carnarvon, Western Australia (jblyth@cheerful.com)
REM *** PLEASE LET ME KNOW OF ANY IMPROVEMENTS/SUGGESTIONS!!
REM *** SET upgrade to upgrade (all lower case to force upgrade to all computers) ****
set upgrade=no
echo WinVNC Sucessfully Installed > success.txt
echo Computers not Found > error.txt
echo Current Version Previously Installed - Not Updated > Previous.txt
REM *** ADD A LIST OF YOUR NT MACHINES BELOW THIS LINE:
Call NTVNC NTComputer1 %upgrade%
Call NTVNC NTComputer2 %upgrade%
:exit
call notepad.exe error.txt
call notepad.exe Success.txt
call notepad.exe Previous.txt
========================================================================