HI , i've some problems to use fastpush sending ultravnc rc18.
Can you send me the correct files ???
Tank's a lot.
Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864
Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864
Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc
fastpush and ultravnc RC18
Just install UltraVNC viewer only on a computer and copy all of the files into the c:\fastpush\ultra folder. Then you can delete the other flavour folders in the c:\fastpush directory as I have removed the multi-flavour support from the script. You will also need a copy of psexec.exe in the c:\fastpush directory. Do a google search, its pretty easy to find. Make sure that you remove the first and last lines from the files, I just placed them so you can see where they end and what they are named. Place the machine.ini in the c:\fastpush\common folder. I replaced the mydetails.exe with a batch file as the executable did not work with windows 9x and I need it to be standard across all platforms [even though I need a separate install for windows 9x]. I've also included an uninstall batch file and a batch file to restart the service. The only thing I havent figured out is how to push the video driver. If anyone has ideas on that they are welcome to share them.
I use this script:
----- vnc.cmd START -----
@ECHO OFF
CLS
:: ****************************************************************************************************
:: * Richard Harris (c), 1999 - 2003 *
:: * Remote VNC installer. See below for version number *
:: * All rights reserved. You may distribute this script but please keep this boilerplate in. *
:: * For updates on the script - check www.darkage.co.uk/vnc from time to time. Use at your own risk! *
:: ****************************************************************************************************
:: ****************************************************************************************************
:: * Modifications by Jason Smyth [philodox] *
:: ****************************************************************************************************
SET FPVER=7.1
SET OLDPATH=%PATH%
IF NOT "%OS%"=="Windows_NT" GOTO NOTNT
:: VARIABLES
SET FLAV=ULTRA
SET VIEWER=NO
SET LOGIT=YES
SET FPLOCATION=C:\FASTPUSH
SET SHORTCUT=NO
SET MACREP=YES
SET SERVICE=YES
SET CMDCHECK=YES
SET CMDARRAY=8
SET SCAN=XCMD REG REGDIR REGINI RMTSHARE SC SHORTCUT TIMEOUT
SET TEST=NO
SET USE=NO
SET LOGON=
SET PASS=
SET LOGVALUE=
SET DRIVE=
SET SHARE=
SET FORCE=
SET SHAREFAIL=
SET WARNING=NO
SET CURRENTPATH=.
SET NEWPATH=
SET FOLDER=
SET PROGFILES=
SET REMOVE=NO
SET CONFIGFILE=NO
SET REMOTETARGET=
SET REG=NO
SET STARTPATH=
SET REMOTEDESK=
SET COMMONDESK=
SET TARGETPC=
SET LNKFOLDER=
SET MISSING=NO
SET PASSFLAG=NO
SET PSEXEC=YES
SET PING=YES
SET OPROGFILES=
:: *** FIND THE COMMAND OPTIONS ***
IF "%1" == "" GOTO HELP
IF "%1" == "/?" GOTO HELP
SET TEST=/?
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" GOTO HELP
SET TEST=/EXAMPLES
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" GOTO EXAMPLES
SET TEST=/REG
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET REG=YES
SET TEST=/REMOVE
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET REMOVE=YES
SET TEST=/UNINSTALL
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET REMOVE=YES
SET TEST=/NOVIEW
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET VIEWER=NO
SET TEST=/WARNING
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET WARNING=YES
SET TEST=/LOG
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET LOGIT=YES
SET TEST=/NOSHORTCUT
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET SHORTCUT=NO
SET TEST=/MANUAL
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET SERVICE=NO
SET TEST=/PWD
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET PASSFLAG=YES
SET TEST=/PSEXEC
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET PSEXEC=YES
SET TEST=/NOPING
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET PING=NO
IF "%2"=="/USER" GOTO USER2
IF "%3"=="/USER" GOTO USER3
IF "%4"=="/USER" GOTO USER4
IF "%5"=="/USER" GOTO USER5
IF "%6"=="/USER" GOTO USER6
IF "%7"=="/USER" GOTO USER7
IF "%8"=="/USER" GOTO USER8
GOTO CUSTOMINI
:USER2
SET USE=YES
SET LOGON=%3
SET PASS=%4
GOTO CUSTOMINI
:USER3
SET USE=YES
SET LOGON=%4
SET PASS=%5
GOTO CUSTOMINI
:USER4
SET USE=YES
SET LOGON=%5
SET PASS=%6
GOTO CUSTOMINI
:USER5
SET USE=YES
SET LOGON=%6
SET PASS=%7
GOTO CUSTOMINI
:USER6
SET USE=YES
SET LOGON=%7
SET PASS=%8
GOTO CUSTOMINI
:USER7
SET USE=YES
SET LOGON=%8
SET PASS=%9
GOTO CUSTOMINI
:: *** PICK UP A CUSTOM VNC INSTALLATION HERE ***
:: LOOKING FOR THE NEW CONFIG FILE WILL BE DONE AFTER THE PATH SEARCHING ROUTINE LATER.
:CUSTOMINI
:: IF "%CONFIGFILE%"=="NO" GOTO HEADER
IF "%2"=="/CUSTOM" SET CONFIGFILE=%3
IF "%3"=="/CUSTOM" SET CONFIGFILE=%4
IF "%4"=="/CUSTOM" SET CONFIGFILE=%5
IF "%5"=="/CUSTOM" SET CONFIGFILE=%6
IF "%6"=="/CUSTOM" SET CONFIGFILE=%7
IF "%7"=="/CUSTOM" SET CONFIGFILE=%8
IF "%8"=="/CUSTOM" SET CONFIGFILE=%9
IF "%2"=="/CONFIG" SET CONFIGFILE=%3
IF "%3"=="/CONFIG" SET CONFIGFILE=%4
IF "%4"=="/CONFIG" SET CONFIGFILE=%5
IF "%5"=="/CONFIG" SET CONFIGFILE=%6
IF "%6"=="/CONFIG" SET CONFIGFILE=%7
IF "%7"=="/CONFIG" SET CONFIGFILE=%8
IF "%8"=="/CONFIG" SET CONFIGFILE=%9
GOTO HEADER
:USER8
ECHO.
ECHO COMMAND LINE TOO LONG!
REM *** THE HELP SCREEN ***
:HELP
CLS
ECHO /****************************************************************************\
ECHO VNC INSTALLER SCRIPT %FPVER% (c) 2003, RICHARD HARRIS [UPDATED BY JASON SMYTH]
ECHO *----------------------------------------------------------------------------*
ECHO * VNC (REMOTE NT BOX) (/TEST) (/USER USER PASSWORD) *
ECHO *----------------------------------------------------------------------------*
ECHO * (REMOTE NT WORKSTATION NAME) MUST NOT BEGIN WITH \\ AND IF IT IS A PURE *
ECHO * NUMBER ADDRESS, YOU SHOULD USE THE PC'S FULL DOMAIN NAME. *
ECHO * *
ECHO * /USER (NAME) (PASSWORD) = CONNECT WITH THESE LOGIN CREDITIALS. *
ECHO * /PWD = ENCRYPT GIVEN PASSWORD INTO VNC SETTINGS *
ECHO * /REG = NO FILE INSTALL, JUST UPDATE THE REGISTRY *
ECHO * *
ECHO * /UNINSTALL OR /REMOVE = DELETES SERVICE, FILES AND REGISTRY KEYS *
ECHO * *
ECHO * /NOVIEW = DO NOT INSTALL VNCVIEWER TO THE CLIENT *
ECHO * /LOG = LOG RESULTS TO CURRENT DIR IN RESULTS.TXT *
ECHO * /CONFIG = USE THIS CONFIG FILE FROM SCRIPT'S FOLDER *
ECHO * /NOSHORTCUT = DO NOT CREATE START MENU LINKS ON TARGET *
ECHO * /MANUAL = SET SERVICE TO NOT START AUTOMATICALLY *
ECHO * *
ECHO * FOR EXAMPLES TRY VNC /EXAMPLES HTTP://WWW.DARKAGE.CO.UK/ *
ECHO \****************************************************************************/
GOTO END
:EXAMPLES
CLS
ECHO /****************************************************************************\
ECHO VNC INSTALLER SCRIPT %FPVER% (c) 2003, RICHARD HARRIS [UPDATED BY JASON SMYTH]
ECHO *----------------------------------------------------------------------------*
ECHO * VNC SERVER2 /NOVIEW = INSTALL VNC BUT NOT THE VIEWER *
ECHO * *
ECHO * VNC JOE /REG /CONFIG D:\PS.INI = DO NOT INSTALL ANY FILES BUT DELETE AND *
ECHO * UPDATE VNC SETTINGS WITH THE NEW INI FILE *
ECHO * *
ECHO * VNC JOE /REG = DO NOT INSTALL ANY FILES. OVERWRITE *
ECHO * EXISTING SETTINGS WITH COMMON SETTINGS *
ECHO * *
ECHO * VNC FREDS_PC /UNINSTALL = REMOVE VNC SERVICE, REG KEYS AND FILES *
ECHO * *
ECHO * VNC FREDS_PC /UNINSTALL /USER ENGINEER LETMEIN *
ECHO * = AS ABOVE, EXCEPT ATTACH AS THAT USER *
ECHO * *
ECHO * VNC SMTP-MAIL /CONFIG SERV.INI = USE A CUSTOM REGINI FILE FROM THE FASTPUSH*
ECHO * FOLDER INSTEAD OF MACHINE.INI *
ECHO * *
ECHO * VNC SMTP2 /CONFIG D:\SERV.INI = USE A CUSTOM FILE FROM THE SPECIFIED PATH *
ECHO * *
ECHO * VNC USER4 /WARNING = INSTALL WARNING BOX *
ECHO * HTTP://WWW.DARKAGE.CO.UK/ *
ECHO \****************************************************************************/
GOTO END
:: *** PRINT OUT A QUICK BOILER PLATE ***
:HEADER
SET TARGETPC=%1
IF "%REMOVE%"=="YES" (ECHO.& ECHO *** REMOVING VNC FROM %TARGETPC% *** & GOTO PATHTEST)
ECHO.
ECHO SCRIPT IS VERSION %FPVER%
ECHO ---------------------------------------------------------------
ECHO YOU WANT TO INSTALL : %FLAV%
IF "%USE%"=="NO" ECHO LOG ON AS : %USERNAME%
IF "%USE%"=="YES" ECHO LOG ON AS : %LOGON%
ECHO LOG OUTPUT TO RESULTS.TXT : %LOGIT%
ECHO INSTALL WARNING BOX : %WARNING%
IF NOT "%CONFIGFILE%"=="NO" ECHO USE VNC REG SETTINGS FROM : %CONFIGFILE%
IF "%REG%"=="YES" ECHO INSTALL METHOD : LEAVE FILES, OVERWRITE REGISTRY
IF "%REG%"=="NO" ECHO INSTALL METHOD : OVERWRITE FILES AND REGISTRY
ECHO INSTALL VNCVIEWER PROGRAM : %VIEWER%
ECHO MY DETAILS START MENU ICON : %MACREP%
ECHO ---------------------------------------------------------------
:: *** CHECK WHAT DIRECTORY THE SCRIPT IS IN AND ADJUST THE PATH ***
:: *** CHECK TO SEE IF THE PATH HAS BEEN ADDED PREVIOUSLY ***
:: *** ADD UTILS TO FRONT OF PATH. THIS MAKES SURE CORRECT PROGS ARE CALLED ***
:PATHTEST
ECHO.
SET OLDPATH=%PATH%
FOR /F "TOKENS=*" %%I IN ('CD') DO SET CURRENTPATH=%%I
:PATHCHECK
:: *** ADD UTILS TO PATH REGARDLESS OF OPTIONS ***
SET TEST=\\
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %FPLOCATION%^|FIND /I /C "%TEST%"') DO @SET PUSHD=%%P
IF "%PUSHD%"=="1" (
ECHO FPLOCATION SET TO UNC PATH
ECHO WILL USE PUSHD TO LINK TO DIRECTORY
PUSHD %FPLOCATION%
FOR /F "TOKENS=*" %%I IN ('CD') DO SET CURRENTPATH=%%I
)
IF "%FPLOCATION%"=="" IF EXIST "%CURRENTPATH%\VNC.CMD" (
ECHO.
ECHO R1
ECHO VNC FOUND AND UPDATING PATH
SET FPLOCATION=%CURRENTPATH%
PATH="%CURRENTPATH%\UTILS";%PATH%
GOTO CFGCHECK
)
IF NOT "%FPLOCATION%"=="" IF EXIST "%FPLOCATION%\VNC.CMD" (
ECHO RESULT - R2
ECHO.
ECHO VNC FOUND IN %FPLOCATION%
SET CURRENTPATH=%FPLOCATION%
GOTO CFGCHECK
)
IF "%FPLOCATION%"=="" IF NOT EXIST "%CURRENTPATH%\VNC.CMD" (
ECHO.
ECHO ERROR CODE - R3
ECHO VNC IS NOT IN THE CURRENT FOLDER AND NO FPLOCATION WAS SET.
ECHO EITHER CD INTO A FOLDER CONTAINING VNC OR SET FPLOCATION.
GOTO END
)
PAUSE
GOTO END
:CFGCHECK
ECHO PATH STATEMENT HAS BEEN BACKED UP AND WILL BE RESTORED AT THE END OF THE SCRIPT
IF "%CONFIGFILE%"=="NO" GOTO CMDCHECK
:: *** IF THERE'S NO CONFIGFILE SET, THEN SKIP ON TO THE UNC ROUTINE ***
ECHO.
IF "%CONFIGFILE%"=="NO" GOTO UNC
IF EXIST "%CONFIGFILE%" ECHO CONFIG FILE FOUND AND WILL BE USED BY REGINI TO INSTALL CUSTOM SETTINGS. & GOTO UNC
IF NOT EXIST "%CURRENTPATH%\%CONFIGFILE%" GOTO CUSTOMERROR
ECHO "%CURRENTPATH%\%CONFIGFILE%" WILL BE USED BY REGINI TO INSTALL CUSTOM VNC SETTINGS.
GOTO CMDCHECK
:CUSTOMERROR
ECHO.
ECHO ********************************************************************
ECHO * ERROR! THE CUSTOM SETTINGS FILE CANNOT BE FOUND. PLEASE PLACE *
ECHO * IT IN THE SAME FOLDER AS FASTPUSH AND DO NOT SPECIFY A FULL PATH *
ECHO ********************************************************************
GOTO END
:: *** UTILITY EXIST CHECK ROUTINE ***
:CMDCHECK
:: SCAN VARIABLE INCLUDES THE FILE NAMES OF EACH UTIL TO CHECK FOR
IF "%CMDCHECK%"=="NO" GOTO UNC
ECHO CHECKING UTILITY AVAILABILITY... PLEASE WAIT.
:: *** CALLING THE CHKCOUNT ROUTINE AT THE END OF THE SCRIPT ***
FOR /L %%G IN (1,1,%CMDARRAY%) DO @CALL :CHKCOUNT %%G
IF "%MISSING%"=="YES" GOTO UTILFAIL
ECHO.
:UNC
:: *** CHECK TO SEE THAT THE TARGET NAME ISN'T AN UNC ***
SET WSNAME=
FOR /F "TOKENS=1,*" %%I IN ('ECHO %TARGETPC%^|FIND /I "\\"') DO @SET WSNAME=%%I
IF "%WSNAME%"=="%TARGETPC%" ECHO. & ECHO WORKSTATION NAME CONTAINS BACKSLASHES. ATTEMPTING REMOVAL. & SET TARGETPC=%WSNAME:~2,30%
ECHO TARGET PC WILL BE '%TARGETPC%'.
IF "%WSNAME%"=="%TARGETPC%" GOTO HELP
IF "%WSNAME%"=="" ECHO MACHINE NAME "%TARGETPC%" IS VALID.
:: *** PING THE TARGET MACHINE TO SEE IF IS ACTIVE ***
:: *** CHECKS FOR TTL AS THIS IS INTERNATIONAL ***
IF "%PING%"=="NO" (
ECHO.
ECHO SKIPPING PING AS REQUESTED
GOTO VNCPASSWD
)
ECHO.
ECHO PLEASE WAIT WHILE THE TCP/IP CONNECTION ON %TARGETPC% IS TESTED.
SET TARGETSTATUS=
FOR /F "SKIP=3 TOKENS=6" %%G IN ('PING %TARGETPC%^|FIND /I "TTL"') DO @SET TARGETSTATUS=%%G
IF "%TARGETSTATUS%"=="" ECHO MACHINE "%TARGETPC%" IS NOT PINGABLE VIA IP & GOTO NOIP
IF NOT "%TARGETSTATUS%"=="" ECHO MACHINE "%TARGETPC%" IS ALIVE, SCRIPT CONTINUING & GOTO VNCPASSWD
ECHO FAIL ON PING TEST?
GOTO END
:VNCPASSWD
IF NOT "%PASSFLAG%"=="YES" GOTO :CONNECTING
ECHO.
ECHO FASTPUSH WILL ENCRYPT AND USE THE PASSWORD YOU SUPPLIED.
ECHO WARNING! THIS WILL OVERRIDE ANY PASSWORD SET IN MACHINE.INI OR ELSEWHERE
IF "%2"=="/PWD" SET VNCPASS=%3
IF "%3"=="/PWD" SET VNCPASS=%4
IF "%4"=="/PWD" SET VNCPASS=%5
IF "%5"=="/PWD" SET VNCPASS=%6
IF "%6"=="/PWD" SET VNCPASS=%7
IF "%7"=="/PWD" SET VNCPASS=%8
IF "%8"=="/PWD" SET VNCPASS=%9
SET PASSTEST=A%VNCPASS%A
IF "%PASSTEST%"=="AA" GOTO PWDFAIL
IF EXIST "%FPLOCATION%\%TARGETPC%PASS.INI" DEL "%FPLOCATION%\%TARGETPC%PASS.INI"
"%FPLOCATION%\UTILS\VNCENC" %VNCPASS% > "%FPLOCATION%\%TARGETPC%PASS.INI"
: *** LOG ON TO THE REMOTE PC ***
:CONNECTING
IF "%USE%"=="YES" GOTO CUSTOMLOGON
NET USE \\%TARGETPC%\IPC$
GOTO IPCSTATUS
:CUSTOMLOGON
ECHO.
ECHO USING PROVIDED LOGIN INFORMATION
NET USE \\%TARGETPC%\IPC$ /USER:%LOGON% %PASS%
:: *** CHECK TO SEE IF THE IPC NULL SESSION WAS ESTABLISHED ***
:: *** GETRENNT IS GERMAN FOR DISCONENCTED ***
:IPCSTATUS
SET IPC=
FOR /F "TOKENS=1,*" %%I IN ('NET USE^|FIND /I "\\%TARGETPC%\IPC$"') DO @SET IPC=%%I
IF "%IPC%"=="OK" GOTO SHARECHECK
IF "%IPC%"=="GETRENNT" GOTO SHARECHECK
IF "%IPC%"=="DISCONNECTED" GOTO SHARECHECK
IF "%IPC%"=="" GOTO DRIVEFAIL
ECHO FAIL UNDER IPCSTATUS
GOTO END
:: *** READ REMOTE PC'S SHARES AND WORK OUT WHICH DRIVE NT LIVES ON *** @@
:SHARECHECK
ECHO CHECKING SHARE ACCESS ON %TARGETPC%
:: FOR /F "TOKENS=2* DELIMS= " %%A IN ('REG QUERY "HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\SYSTEMROOT" \\%TARGETPC%') DO SET SHARE=%%B
:: FOR /F "TOKENS=1* DELIMS=:\" %%I IN ('ECHO %SHARE%^|FIND /I ":"') DO @SET REMOTETARGET=%%I
:: FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\SYSTEMROOT" \\%TARGETPC%') DO SET FOLDER=%%D
:: FOR /F "TOKENS=2 DELIMS=:\" %%G IN ('REG QUERY "HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\PROGRAMFILESDIR" \\%TARGETPC%') DO SET PROGFILES=%%G
FOR /F "TOKENS=2* DELIMS= " %%A IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /V SYSTEMROOT') DO SET SHARE=%%B
FOR /F "TOKENS=1* DELIMS=:\" %%I IN ('ECHO %SHARE%^|FIND /I ":"') DO @SET REMOTETARGET=%%I
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /V SYSTEMROOT') DO SET FOLDER=%%D
FOR /F "TOKENS=2 DELIMS=:\" %%G IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION" /V PROGRAMFILESDIR') DO SET OPROGFILES=%%G
:: SET PROGFILES FOR THE OLD VNC VERSION
SET PROGFILES=%OPROGFILES%\ORL\VNC
ECHO QUERYING REMOTE PC %TARGETPC% TO LOCATE THE START MENU. PLEASE WAIT.
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V "COMMON PROGRAMS"') DO SET COMMONPROGS=%%D
SET STARTPATH=\\%TARGETPC%\%REMOTETARGET%$\%COMMONPROGS%
:: DON'T USE QUOTES ON THE PROGFILES VARIABLE, IT GETS UPSET!
ECHO WINDOWS (ON MACHINE %TARGETPC%) IS ON DRIVE %REMOTETARGET% IN %FOLDER% AND VNC WILL BE
ECHO INSTALLED INTO %REMOTETARGET%:\%PROGFILES% ON %TARGETPC%.
IF "%REMOTETARGET%"=="" GOTO REGFAIL
GOTO NETUSE
:REGFAIL
REM *** NO ADMIN SHARE WAS FOUND, SO EXIT GRACEFULLY ***
ECHO ***************************************************************************
ECHO * SCRIPT COULD NOT FIND WHERE NT IS INSTALLED ON THE REMOTE MACHINE. *
ECHO * TRY USING THE MACHINE'S IP ADDRESS RATHER THAN IT'S NAME FOR THE TARGET *
ECHO ***************************************************************************
ECHO.
ECHO THE COMMAND WAS:
ECHO REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /V SYSTEMROOT
ECHO.
ECHO CHECK THAT YOU ARE USING REG VERSION 3 (INCLUDED IN XP SYSTEM) AND NOT AN EARLIER EDITION.
GOTO CLEANUP
:: *** MAKE A LINK TO THE REMOTE PC AND RECREATE DRIVE SHARE IF NECESSARY ***
:NETUSE
IF EXIST \\%TARGETPC%\%REMOTETARGET%$\*.* GOTO INSTALLCHECK
ECHO THE %REMOTETARGET%$ SHARE WAS UNAVAILABLE. ATTEMPTING TO RECRATE IT.
ECHO RMTSHARE \\%TARGETPC%\%REMOTETARGET%$=%REMOTETARGET%:\
RMTSHARE \\%TARGETPC%\%REMOTETARGET%$=%REMOTETARGET%:\
IF EXIST \\%TARGETPC%\%REMOTETARGET%$\*.* GOTO INSTALLCHECK
GOTO DRIVEFAIL
:INSTALLCHECK
:: *** CHECK FOR EXISTING VNC INSTALL AND IF NECESSARY, KILL THE SERVICE ***
SET VNCSTATE=
ECHO.
FOR /F "TOKENS=4 DELIMS= " %%I IN ('SC \\%TARGETPC% QUERY WINVNC^|FIND /I "STATE"') DO @SET VNCSTATE=%%I
IF "%VNCSTATE%"=="RUNNING" (ECHO VNC3 IS RUNNING ON %TARGETPC%.&GOTO STOPSERVICE)
IF "%VNCSTATE%"=="" (ECHO THE VNC3 SERVICE IS NOT ACTIVE ON %TARGETPC%. CONTINUING WITH SCRIPT.&GOTO :VNC4STATE)
IF "%VNCSTATE%"=="STOPPED" GOTO DELETESERVICE
IF "%VNCSTATE%"=="STOP_PENDING" ECHO *** WARNING! SERVICE HAS HUNG ON STOP. SUGGEST REMOTE REBOOT OR PSKILL. SCRIPT WILL NOW END *** & GOTO END
ECHO VNC3 FAIL ON SERVICE STATE?
:VNC4STATE
FOR /F "TOKENS=4 DELIMS= " %%I IN ('SC \\%TARGETPC% QUERY WINVNC4^|FIND /I "STATE"') DO @SET VNC4STATE=%%I
IF "%VNC4STATE%"=="RUNNING" (ECHO VNC4 IS RUNNING ON %TARGETPC%.&GOTO STOPSERVICE)
IF "%VNC4STATE%"=="" (ECHO THE VNC4 SERVICE IS NOT ACTIVE ON %TARGETPC%. CONTINUING WITH SCRIPT.&GOTO :CHOOSEVNC)
IF "%VNC4STATE%"=="STOPPED" GOTO DELETESERVICE
IF "%VNC4STATE%"=="STOP_PENDING" ECHO *** WARNING! VNC4 SERVICE HAS HUNG ON STOP. SUGGEST REMOTE REBOOT OR PSKILL. SCRIPT WILL NOW END *** & GOTO END
ECHO VNC4 FAIL ON SERVICE STATE?
GOTO END
:STOPSERVICE
ECHO STOPPING THE WINVNC SERVICE ON %TARGETPC%.
SC \\%TARGETPC% STOP WINVNC :: > NUL
ECHO. STOP PENDING
%FPLOCATION%\UTILS\TIMEOUT.EXE 8
:DELETESERVICE
ECHO DELETING THE WINVNC SERVICE ON %TARGETPC%.
SC \\%TARGETPC% DELETE WINVNC
ECHO DELETING PREVIOUS VNC REGISTRY KEYS FROM %TARGETPC%.
REG DELETE \\%TARGETPC%\HKLM\SOFTWARE\ORL /F > NUL
REG DELETE \\%TARGETPC%\HKU\.DEFAULT\SOFTWARE\ORL /F > NUL
REG DELETE \\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN /V WINVNC /F > NUL
REG DELETE \\%TARGETPC%\HKLM\SOFTWARE\ULTRAVNC /F > NUL
:: *** CHOOSE THE VNC FLAVOUR AND INSTALL AS NECESSARY ***
:CHOOSEVNC
SET TARGETPATH="\\%TARGETPC%\%REMOTETARGET%$\%PROGFILES%"
IF "%REMOVE%"=="YES" GOTO REMOVEVNC
IF "%REG%"=="YES" GOTO REGONLY
ECHO.
ECHO YOUR COMMAND LINE OPTION WAS TO INSTALL %FLAV%.
ECHO.
ECHO DESTINATION FOR INSTALLATION WILL BE %TARGETPATH%.
ECHO.
:: *** USE THE FLAVOUR VARIABLE TO PICK THE RIGHT SOURCE FOLDER FOR VNC ***
IF NOT EXIST %TARGETPATH% MD %TARGETPATH%
IF EXIST %TARGETPATH% ECHO DIRECTORY %TARGETPATH% EXISTS.
ECHO COPY FILES TO %TARGETPATH% FROM %CURRENTPATH%\%FLAV%.
SET COPYCMD=/Y
IF EXIST "%TARGETPATH%\VNCHOOKS.DLL" RENAME "%TARGETPATH%\VNCHOOKS.DLL" VNCHOOKS.OLD
IF EXIST "%TARGETPATH%\VNCHOOKS.OLD" DEL "%TARGETPATH%\VNCHOOKS.OLD"
XCOPY "%CURRENTPATH%\%FLAV%\*.DLL" %TARGETPATH% /F /R /V
XCOPY "%CURRENTPATH%\%FLAV%\WINVNC.EXE" %TARGETPATH% /F /R /V
XCOPY "%CURRENTPATH%\%FLAV%\VNCHOOKS.REG" %TARGETPATH% /F /R /V
:: AD AUTHENTICATED DLLS FOR ULTRAVNC
ECHO AD
IF EXIST "%CURRENTPATH%\%FLAV%\AU*.DLL" XCOPY "%CURRENTPATH%\%FLAV%\AU*.DLL" %TARGETPATH% /F /R /V
IF "%MACREP%"=="YES" XCOPY "%CURRENTPATH%\COMMON\MYDETAILS.BAT" "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\MYDETAILS.BAT" /F /R /V
IF "%MACREP%"=="YES" XCOPY "%CURRENTPATH%\COMMON\My Details.lnk" "%STARTPATH%\.." /F /R /V
IF EXIST "%CURRENTPATH%\%FLAV%\Z*.DLL" XCOPY "%CURRENTPATH%\%FLAV%\Z*.DLL" %TARGETPATH% /F /R /V
IF "%VIEWER%"=="YES" XCOPY "%CURRENTPATH%\%FLAV%\VNCVI*.EXE" %TARGETPATH% /F /R /V
GOTO WHATCONFIG
:REGONLY
ECHO ******************************************************************
ECHO * NOT UPDATING CLIENT FILES - ONLY THE REGISTRY. *
ECHO * THIS MAY BE USED WITH THE /CONFIG OPTION FOR MORE FLEXIBILITY. *
ECHO ******************************************************************
:WHATCONFIG
:: *** CHECK FOR CUSTOM INSTALL, IF SO DO IT AND SKIP ON ***
IF "%CONFIGFILE%"=="NO" GOTO DEFAULTVNC
ECHO.
ECHO *******************************************************************************
ECHO * WARNING! YOU ARE ABOUT TO USE YOUR OWN REGISTRY INI FILE TO CONTROL VNC *
ECHO * UNLESS ALL SETTINGS ARE CORRECT, THE SERVICE MAY NOT START AND *
ECHO * YOU MAY DAMAGE THE REGISTRY OF THE REMOTE COMPUTER *
ECHO * *
ECHO * ONLY USE INI FILES THAT HAVE BEEN CREATED BY EXPORTING THE KEYS WITH REGDIR *
ECHO * EG: REGDIR \REGISTRY\MACHINE\SOFTWARE\ORL\WINVNC3\DEFAULT > C:\TEST.INI *
ECHO * *
ECHO * RERUN THIS SCRIPT WITH /REMOVE WILL DELETE VNC AND THE EXISTING STANDARD *
ECHO * KEYS AS REGINI WILL NOT REPLACE EXISTING REGISTRY ENTRIES *
ECHO * *
ECHO * FASTPUSH WILL CHECK IT'S OWN FOLDER FOR A CONFIG FILE FIRST AND THEN CHECK *
ECHO * A LISTED PATH SECOND. *
ECHO *******************************************************************************
%FPLOCATION%\UTILS\TIMEOUT.EXE 10
IF EXIST "%CONFIGFILE%" GOTO INFOLDER
IF EXIST "%CURRENTPATH%\%CONFIGFILE%" GOTO FROMPATH
ECHO ERROR ON PATH CHECKER
GOTO END
:INFOLDER
ECHO USING : REGINI -M \\%TARGETPC% "%CONFIGFILE%"
REGINI -M \\%TARGETPC% "%CONFIGFILE%"
%FPLOCATION%\UTILS\TIMEOUT.EXE 10
GOTO NEWPASS
:FROMPATH
ECHO USING : REGINI -M \\%TARGETPC% "%CURRENTPATH%\%CONFIGFILE%"
REGINI -M \\%TARGETPC% "%CURRENTPATH%\%CONFIGFILE%"
%FPLOCATION%\UTILS\TIMEOUT.EXE 10
GOTO NEWPASS
:: *** INSTALL THE DEFAULT VNC SETTINGS ***
:DEFAULTVNC
ECHO.
ECHO INSTALLING THE DEFAULT SETTINGS FOR VNC INTO THE REMOTE REGISTRY. PLEASE WAIT.
ECHO REGINI -M \\%TARGETPC% "%CURRENTPATH%\COMMON\MACHINE.INI"
REGINI -M \\%TARGETPC% "%CURRENTPATH%\COMMON\MACHINE.INI" > NUL
:: *** ALLOW FOR CUSTOM REGISTRY SETTINGS ***
:: *** IF A FILE THAT MATCHES THE MACHINE NAME EXISTS, COPY THIS INTO THE REGISTRY. ***
:: *** THIS ALLOWS DIFFERENT PASSWORDS, IP RESTRICTION, ETC. SUGGESTED BY RYAN CASEY ***
IF EXIST "%CURRENTPATH%\COMMON\%TARGETPC%.INI" REGINI -M \\%TARGETPC% "%CURRENTPATH%\COMMON\%TARGETPC%.INI" > NUL
:NEWPASS
IF NOT "%PASSFLAG%"=="YES" GOTO :INSTALLHELPER
ECHO *** USING COMMAND LINE SPECIFIED VNC PASSWORD ***
ECHO *** THIS WILL OVERRIDE ANY SET IN A CUSTOM INI FILE ***
REGINI -M \\%TARGETPC% "%FPLOCATION%\%TARGETPC%PASS.INI"
DEL "%FPLOCATION%\%TARGETPC%PASS.INI"
GOTO INSTALLHELPER
:INSTALLHELPER
:: *** THE INST ROUTINE INSTALLS THE VNC SERVICE AND HELPER ***
ECHO.
ECHO INSTALLING WINVNC TO %REMOTETARGET%:\%PROGFILES%
:: SET IF YOU WANT THE SERVICE TO BE A MANUAL START - CHANGE AUTO TO MANUAL
IF "%SERVICE%"=="YES" SC \\%TARGETPC% CREATE WINVNC BINPATH= "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE -SERVICE" TYPE= OWN TYPE= INTERACT START= AUTO
IF "%SERVICE%"=="NO" SC \\%TARGETPC% CREATE WINVNC BINPATH= "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE -SERVICE" TYPE= OWN TYPE= INTERACT START= DEMAND
:: *** INSTALL THE SERVICE HELPER TO THE REMOTE REGISTRY ***
IF EXIST "%CURRENTPATH%\PATH.TMP" DEL "%CURRENTPATH%\PATH.TMP"
IF EXIST "%CURRENTPATH%\HELPER.INI" DEL "%CURRENTPATH%\HELPER.INI"
ECHO.
ECHO SETTING VNC HELPER IN HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN TO:
ECHO WINVNC = "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -SERVICEHELPER
ECHO WINVNC = "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -SERVICEHELPER> %CURRENTPATH%\PATH.TMP
COPY "%CURRENTPATH%\COMMON\HELPER.INI" + "%CURRENTPATH%\PATH.TMP" "%CURRENTPATH%\HELPER.TMP" > NUL
REGINI -M \\%TARGETPC% "%CURRENTPATH%\HELPER.TMP"
DEL "%CURRENTPATH%\*.TMP"
GOTO STARTSERVER
:STARTSERVER
:: *** FIRE UP THE SERVICE ***
ECHO ATTEMPTING TO START THE SERVICE.....
IF "%SERVICE%"=="YES" SC \\%TARGETPC% START WINVNC
IF "%SERVICE%"=="NO" ECHO.& ECHO FASTPUSH WILL START THE REMOTE WINVNC SERVICE, BUT IT WILL NOT SURVIVE A REBOOT. & SC \\%TARGETPC% START WINVNC
:MAKESHORTS
:: *** SHORTCUT CREATION ROUTINE ***
ECHO.
IF "%SHORTCUT%"=="NO" ECHO SKIPPED START MENU SHORTCUT CREATION & GOTO SUCCESS
IF "%SHORTCUT%"=="YES" ECHO BEGINNING START MENU SHORTCUT CREATION
ECHO.
ECHO SCRIPT WILL ATTEMPT TO CREATE VNC ICONS UNDER:
ECHO '%STARTPATH%\VNC'.
IF EXIST "%STARTPATH%\VNC" RD "%STARTPATH%\VNC" /Q /S | ECHO DELETED EXISTING VNC START MENU OPTIONS.
:: *** READ THE REG AND WORK OUT WHERE THE ALL USERS' DESKTOP IS ***
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V "COMMON DESKTOP"') DO SET COMMONDESK=%%D
SET REMOTEDESK=\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%
:: *** CREATE A BATCH FILE TO CREATE SHORTCUTS ON REMOTE PC ***
IF EXIST "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD" DEL /Q "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
IF NOT EXIST "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\SHORTCUT.EXE" COPY "%FPLOCATION%\UTILS\SHORTCUT.EXE" "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32"
ECHO @ECHO OFF>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
IF EXIST "%STARTPATH%\REALVNC\*.*" RD "%STARTPATH%\REALVNC" /S /Q
IF NOT EXIST "%STARTPATH%\VNC" MKDIR "%STARTPATH%\VNC"
IF NOT EXIST "%STARTPATH%\VNC\VNC SERVER" MKDIR "%STARTPATH%\VNC\VNC SERVER"
IF NOT EXIST "%STARTPATH%\VNC\VNC VIEWER" MKDIR "%STARTPATH%\VNC\VNC VIEWER"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\VNCVIEWER.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\RUN VNC VIEWER" -D "%REMOTETARGET%:\%PROGFILES%">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\RUN VNC SERVER" -D "%REMOTETARGET%:\%PROGFILES%">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\ADD NEW CLIENT" -D "%REMOTETARGET%:\%PROGFILES%" -A "-CONNECT">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\REGISTER VNC SERVER SERVICE" -D "%REMOTETARGET%:\%PROGFILES%" -A "-INSTALL">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\RUN SERVICE HELPER" -D "%REMOTETARGET%:\%PROGFILES%" -A "-SERVICEHELPER">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\SHOW ABOUT BOX" -D "%REMOTETARGET%:\%PROGFILES%" -A "-ABOUT">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\SHOW DEFAULT PROPERTIES" -D "%REMOTETARGET%:\%PROGFILES%" -A "-DEFAULTSETTINGS">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\SHOW USER PROPERTIES" -D "%REMOTETARGET%:\%PROGFILES%" -A "-SETTINGS">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\UNREGISTER VNC SERVICE" -D "%REMOTETARGET%:\%PROGFILES%" -A "-REMOVE">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\VNCVIEWER.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC VIEWER\LISTENING VNC VIEWER" -D "%REMOTETARGET%:\%PROGFILES%" -A "-LISTEN" >>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\VNCVIEWER.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC VIEWER\REGISTER VIEWER WITH SAVED SESSIONS" -D "%REMOTETARGET%:\%PROGFILES%" -A "-REGISTER">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
:: *** IF REPORTING OPTION IS ON, CREATE A DESKTOP LINK SO USERS CAN FIND OUT WHAT BOX THEY'RE USING ***
IF "%MACREP%" NEQ "YES" GOTO RUNICONS
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%FOLDER%\SYSTEM32\MYDETAILS.EXE" -N "%REMOTETARGET%:\%COMMONDESK%\MY DETAILS" >>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%FOLDER%\SYSTEM32\MYDETAILS.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\MY DETAILS" >>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
:: *** EXECUTE BATCH FILE ON REMOTE COMPUTER ***
:RUNICONS
ECHO.
IF "%PSEXEC%"=="YES" PSEXEC \\%TARGETPC% "%REMOTETARGET%:\%FOLDER%\ICONS.CMD"
IF NOT "%PSEXEC%"=="YES" XCMD \\%TARGETPC% "%REMOTETARGET%:\%FOLDER%\ICONS.CMD"
:: XCMD NOT DOES SEEM AS RELIABLE FOR SOME REASON - INVESTIGATE
:: XCMD \\%TARGETPC% "%REMOTETARGET%:\%FOLDER%\ICONS.CMD"
GOTO REM%ERRORLEVEL%
:: GOTO :SUCCESS
:REM0
ECHO.
ECHO ICONS COMMAND EXCUTED ON REMOTE MACHINE %TARGETPC%
ECHO DEL "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD" /Q
GOTO SUCCESS
:REM1
ECHO.
ECHO *** WARNING! ***
ECHO ICONS COMMAND FAILED!! INVESTIGATE %TARGETPC%.
GOTO SUCCESS
:REM-1
ECHO.
ECHO *** WARNING! ***
ECHO ICONS COMMAND FAILED!! INVESTIGATE %TARGETPC%.
GOTO SUCCESS
:REM128
ECHO.
ECHO *** WARNING! ***
ECHO XCMD SERVICE UNABLE TO BE INSTALLED. INVESTIGATE %TARGETPC%.
ECHO SHORTCUTS WERE NOT CREATED / UPDATED.
GOTO SUCCESS
ECHO END OF SHORTCUT CREATION SCHEME
GOTO SUCCESS
:FORCECHECK
IF NOT "%FORCE%"=="YES" GOTO DRIVEFAIL
RMTSHARE \\%TARGETPC%\%REMOTEDRIVE%$=%REMOTEDRIVE%:\
IF "%SHAREFAIL%"="YES" GOTO DRIVEFAIL
SET SHAREFAIL=YES
GOTO NETUSE
:: *** REMOVE THE VNC PROGRAM AND REGISTRY SETTINGS ***
:REMOVEVNC
ECHO.
ECHO YOUR COMMAND LINE OPTION WAS TO REMOVE VNC FROM %TARGETPC%.
ECHO.
ECHO VNC FILES AND HOST DIRECTORY WILL BE DELETED FROM %TARGETPATH%
ECHO THE REGISTRY ENTRIES WILL ALSO BE DELETED.
REM IAMHERE PSEXEC \\%TARGETPC% NET STOP WINVNC
IF EXIST "%TARGETPATH%\VNCHOOKS.DLL" DEL "%TARGETPATH%\VNCHOOKS.DLL" /Q /F
IF EXIST %TARGETPATH% RD %TARGETPATH% /Q /S | ECHO %TARGETPATH% FOLDER REMOVED.
IF EXIST "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\OMNITHREAD*.DLL" DEL "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\OMNITHREAD*.DLL" /S
IF EXIST "%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\MY DETAILS.BAT" DEL "%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\MY DETAILS.BAT" /Q
IF EXIST "%STARTPATH%\..\MY DETAILS.LNK" DEL "%STARTPATH%\..\MY DETAILS.LNK" /Q | ECHO DELETED THE 'MY DETAILS' PROGRAM AND SHORTCUTS.
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V "COMMON DESKTOP"') DO SET COMMONDESK=%%D
SET REMOTEDESK=\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%
IF EXIST "\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%\MY DETAILS.LNK" ECHO DELETING THE MY DETAILS ICON FROM THE DESKTOP & DEL /Q "\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%\MY DETAILS.LNK"
ECHO REMOVING \\%TARGETPC%\IPC$ LINK.
NET USE \\%TARGETPC%\IPC$ /DEL
SET LOGVALUE=KILLED
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:NOIP
ECHO.
ECHO *************************************************************************
ECHO * ERROR: IP ACCESS TO MACHINE IS NOT AVAILABLE! CHECK NETWORK AND POWER *
ECHO *************************************************************************
SET LOGVALUE=NOIP
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:EMPTY
ECHO.
ECHO *****************************************************
ECHO * ERROR! ECHO YOU HAVE NOT SPECIFIED A MACHINE NAME *
ECHO *****************************************************
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:NOTNT
ECHO.
ECHO ************************************************
ECHO * ERROR: ECHO THIS PROGRAM ONLY WORKS UNDER NT *
ECHO ************************************************
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:NOVNCCMD
ECHO.
ECHO ********************************************************************************
ECHO * ERROR: VNC.CMD FILE NOT FOUND WITH THE PATH SPECIFIED IN FPLOCATION VARIABLE *
ECHO ********************************************************************************
SET LOGVALUE=NOVNDCMD
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:DRIVEFAIL
ECHO.
ECHO *****************************************************************************
ECHO * ERROR: ECHO THERE WAS NO DRIVE MAPPED TO THE TARGET MACHINE'S SYSTEMDRIVE *
ECHO * TRY A MANUAL NET USE %NETDRV% \\MACHINE\DRIVE$ /USER:ADMIN_ACCOUNT *
ECHO * NB: MAKE SURE THE TARGET PC IS NOT A WINDOWS 9X OR LINUX BOX *
ECHO *****************************************************************************
SET LOGVALUE=DRIVEFAIL
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:UTILFAIL
ECHO.
ECHO *****************************************************************************
ECHO * ERROR: A UTILITY CRITICAL TO THE OPERATION OF FASTPUSH COULD NOT BE FOUND *
ECHO * PLEASE INSTALL THIS EXECUTEABLE INTO THE FASTPUSH\UTILS FOLDER *
ECHO *****************************************************************************
SET LOGVALUE=NOUTIL
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:PWDFAIL
ECHO.
ECHO *****************************************************************************
ECHO * ERROR: YOU SPECIFIED /PWD TO USE A CUSTOM VNC PASSWORD. HOWEVER YOU DID *
ECHO * NOT PROVIDE A PASSWORD AFTER USING THIS SWITCH. PLEASE TRY AGAIN. *
ECHO *****************************************************************************
SET LOGVALUE=NOPWD
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:SUCCESS
SET LOGVALUE=INSTALLED
GOTO CLEANUP
:: *** DELETE THE DRIVE MAPPING AND KILL THE IPC CONNECTION OFF TOO ***
:CLEANUP
NET USE \\%TARGETPC%\IPC$ /DEL > NUL
IF EXIST %NETDRV%: NET USE %NETDRV%: /DEL > NUL
ECHO ------------------------------------------------------------
ECHO FASTPUSH TO '%TARGETPC%'.
ECHO YOU WANT TO INSTALL : %FLAV%
IF "%USE%"=="YES" ECHO LOG ON AS : %LOGON%
IF "%USE%"=="YES" ECHO USE THIS PASSWORD : HIDDEN
IF "%LOG%"=="YES" ECHO LOGGING RESULTS TO RESULTS.TXT
IF "%WARNING%"=="YES" ECHO INSTALL WARNING BOX : YES
IF NOT "%CONFIGFILE%"=="NO" ECHO USE VNC REG SETTINGS FROM : %CONFIGFILE%
ECHO INSTALL VNCVIEWER PROGRAM : %VIEWER%
ECHO CREATE START MENU LINKS : %SHORTCUT%
ECHO ------------------------------------------------------------
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:LOGGING
ECHO LOGGING RESULTS TO "%CURRENTPATH%\RESULTS.TXT"
:: *** PIPE THE TIME AND DATE INTO VARIABLES ***
FOR /F "TOKENS=2,*" %%I IN ('DATE/T') DO @SET ZDATE=%%I
FOR /F "TOKENS=1,*" %%J IN ('TIME/T') DO @SET ZCLOCK=%%J
:: *** IF RESULTS FILES DOESN'T EXIST, THEN MAKE ONE ***
IF NOT EXIST %CURRENTPATH%\RESULTS.TXT ECHO FASTPUSH INSTALLATION LOG (DATE / TIME / TARGET / RESULTS) > RESULTS.TXT
:: *** TIME, DATE, ETC. PIPED OUT TO TMP FILE ***
IF "%LOGVALUE%"=="INSTALLED" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : %FLAV% WAS INSTALLED TO %TARGETPC%. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOIP" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : ERROR: %TARGETPC% NOT PINGABLE. CHECK TCP/IP. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOREG" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : NT SYSTEM FOLDER NOT FOUND. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOSHARE" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : $ADMIN SHARE ON %TARGETPC% UNAVAILABLE. CHECK SHARES. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="DRIVEFAIL" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : FAILED TO LOGON TO %TARGETPC%. CHECK LOGON/SHARES. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="KILLED" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : VNC SERVICE AND FILES WERE REMOVED. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOVNCCMD" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : VNC COMMAND FILE NOT FOUND. CHECK PATH VARIABLE > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOCMD" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : NO VALID COMMAND LINE OPTIONS WERE FOUND > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOUTIL" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : NO VALID COMMAND LINE OPTIONS WERE FOUND > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOPWD" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : SPECIFIED /PWD BUT DID NOT SUPPLY A PASSWORD > "%CURRENTPATH%\RESULTS.TMP"
REN "%CURRENTPATH%\RESULTS.TXT" OLDRESULTS.TMP > NUL
COPY "%CURRENTPATH%\OLDRESULTS.TMP" + "%CURRENTPATH%\RESULTS.TMP" "%CURRENTPATH%\RESULTS.TXT" > NUL
DEL "%CURRENTPATH%\*.TMP" > NUL
GOTO END
:: *** INSERT CALLED PROCEDURES HERE ***
:: *** THEY WON'T BE RUN UNLESS CALLED DIRECTLY ***
:CHKCOUNT
:: *** PICK EACH ITEM FROM THE SCAN ARRAY ***
FOR /F "TOKENS=%1 DELIMS= " %%P IN ('ECHO %SCAN%') DO @CALL :CHKUTIL %%P
GOTO :EOF
:CHKUTIL
:: *** CHECK FOR THE EXISTANCE OF EACH COMPONENT ***
IF "%MISSING%"=="YES" GOTO :EOF
:: IF EXIST %CURRENTPATH%\UTILS\%1.EXE ECHO %1 OKAY.
IF NOT EXIST %CURRENTPATH%\UTILS\%1.EXE ECHO %1 NOT FOUND. PLEASE INSTALL %1 IN %CURRENTPATH%\UTILS. & SET MISSING=YES
GOTO :EOF
:END
:: *** END OF THE LINE ***
SET USER=
SET PASS=
SET VNCPASS=
IF "%PUSHD%"=="1" POPD
IF EXIST "%FPLOCATION%\%TARGETPC%PASS.INI" DEL "%FPLOCATION%\%TARGETPC%PASS.INI"
:: ECHO RESTORING OLD PATH TO "%OLDPATH%".
SET PATH=%OLDPATH%
----- vnc.cmd END -----
With this frontend batch file for installs:
----- vncinst.bat START -----
@echo off
IF "%1" == "" GOTO ERROR
IF "%2" == "" GOTO ERROR
IF "%3" == "" GOTO ERROR
cd c:\FastPush
call vnc %1 /user %1\%2 %3
psexec \\%1 -u %1\%2 -p %3 c:\windows\regedit.exe /q /s "c:\program files\orl\vnc\vnchooks.reg" >NUL
echo.
echo DONE
GOTO END
:ERROR
cls
echo.
echo Usage: vncinst [remote NT box] [local admin user name] [local admin password]
echo.
:END
----- vncinst.bat END -----
With this frontend batch file for uninstalls:
----- vncuninst.bat START -----
@echo off
IF "%1" == "" GOTO ERROR
IF "%2" == "" GOTO ERROR
IF "%3" == "" GOTO ERROR
:EXECUTE
cd c:\FastPush
call vnc %1 /user %1\%2 %3 /remove
ECHO.
ECHO DONE
GOTO END
:ERROR
cls
echo.
echo Usage: vncuninst [remote NT box] [local admin user name] [local admin password]
echo.
:END
----- vncuninst.bat END -----
A Batch file to restart the service:
----- startvnc.bat START -----
@echo off
IF "%1" == "" GOTO ERROR
IF "%2" == "" GOTO ERROR
IF "%3" == "" GOTO ERROR
FOR /F "TOKENS=2,*" %%I IN ('DATE/T') DO @SET ZDATE=%%I
FOR /F "TOKENS=1,*" %%J IN ('TIME/T') DO @SET ZCLOCK=%%J
cd c:\fastpush
cls
psexec \\%1 -u %1\%2 -p %3 net stop winvnc
psexec \\%1 -u %1\%2 -p %3 net start winvnc
ECHO.
ECHO %ZDATE% : %ZCLOCK% : %1 : VNC SERVICE WAS MANUALLY RESTARTED. > RESULTS.TMP
REN RESULTS.TXT OLDRESULTS.TMP > NUL
COPY OLDRESULTS.TMP + RESULTS.TMP RESULTS.TXT > NUL
DEL *.TMP > NUL
ECHO LOGGING RESULTS TO "%CURRENTPATH%\RESULTS.TXT"
ECHO.
ECHO DONE
GOTO END
:ERROR
cls
echo.
echo Usage: startvnc [remote NT box] [local admin user name] [local admin password]
echo.
:END
----- startvnc.bat END -----
And this machine.ini:
----- machine.ini START -----
\registry\machine\software\orl\winvnc3
AllowLoopback = REG_DWORD 0x00000000
Debug Level = REG_DWORD 0x00000000
Debug Mode = REG_DWORD 0x00000000
DisableTrayIcon = REG_DWORD 0x00000001
MSLogonRequired = REG_DWORD 0x00000001
UseDSMPlugin = REG_DWORD 0x00000000
\registry\machine\software\orl\winvnc3\default
AllowEditClients = REG_DWORD 0x00000000
AllowLoopback = REG_DWORD 0x00000000
AllowProperties = REG_DWORD 0x00000000
AllowShutdown = REG_DWORD 0x00000000
AutoPortSelect = REG_DWORD 0x00000001
BlankMonitorEnabled = REG_DWORD 0x00000001
DefaultScale = REG_DWORD 0x00000001
EnableDriver = REG_DWORD 0x00000001
EnableHook = REG_DWORD 0x00000001
EnableVirtual = REG_DWORD 0x00000000
FileTransferEnabled = REG_DWORD 0x00000001
HTTPConnect = REG_DWORD 0x00000000
IdleTimeout = REG_DWORD 0x00000000
InputsEnabled = REG_DWORD 0x00000001
LocalInputsDisabled = REG_DWORD 0x00000000
LockSetting = REG_DWORD 0x00000000
OnlyPollConsole = REG_DWORD 0x00000001
OnlyPollOnEvent = REG_DWORD 0x00000000
Password = REG_BINARY 0x00000008 0xe46754dc 0xf6fbfb3a
PollForeground = REG_DWORD 0x00000001
PollFullScreen = REG_DWORD 0x00000001
PollUnderCursor = REG_DWORD 0x00000000
QuerySetting = REG_DWORD 0x00000004
QueryTimeout = REG_DWORD 0x0000000F
RemoveWallpaper = REG_DWORD 0x00000001
SocketConnect = REG_DWORD 0x00000001
TurboMode = REG_DWORD 0x00000001
UseDSMPlugin = REG_DWORD 0x00000000
XDMCPConnect = REG_DWORD 0x00000000
\registry\machine\software\ultravnc\mslogon
group1 = REG_BINARY 0x0000000C 0x2D484F4D 0x504C4548 0x4B534544
locdom1 = REG_DWORD 0x00000002
\registry\users\.default\software\orl
VNCHooks
Application_Prefs
CALC.EXE
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000000
use_LButtonUp = REG_DWORD 0x00000000
use_Deferral = REG_DWORD 0x00000001
CLOCK.EXE
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000001
use_KeyPress = REG_DWORD 0x00000000
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000000
explorer.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000000
use_MButtonUp = REG_DWORD 0x00000001
use_RButtonUp = REG_DWORD 0x00000001
iexplore.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
mspaint.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
NOTEPAD.EXE
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
use_MButtonUp = REG_DWORD 0x00000001
use_RButtonUp = REG_DWORD 0x00000001
winlogon.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
use_MButtonUp = REG_DWORD 0x00000001
use_RButtonUp = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
----- machine.ini END -----
The mydetails.bat batch file:
----- mydetails.bat START -----
@echo off
cls
ver
echo.
echo User Name: %USERNAME%
echo.
echo Domain: %USERDOMAIN%
echo.
echo Computer Name: %COMPUTERNAME%
ipconfig
echo.
echo Press any key to exit the program.
PAUSE >NUL
----- mydetails.bat END -----
NOTE: for the mydetails.bat to work you will need to place it in the c:\fastpush\common folder and you will need to make a link to it and call the link 'My Details.lnk'. I suggest using one of those nice question mark icons in XP for this link... makes it look professional. It will place this link in the start menu for easy user access. For windows 9x you will need to change the ipconfig command to a 'winipcfg /batch temp.txt' command and then type the temp.txt file.
I use this script:
----- vnc.cmd START -----
@ECHO OFF
CLS
:: ****************************************************************************************************
:: * Richard Harris (c), 1999 - 2003 *
:: * Remote VNC installer. See below for version number *
:: * All rights reserved. You may distribute this script but please keep this boilerplate in. *
:: * For updates on the script - check www.darkage.co.uk/vnc from time to time. Use at your own risk! *
:: ****************************************************************************************************
:: ****************************************************************************************************
:: * Modifications by Jason Smyth [philodox] *
:: ****************************************************************************************************
SET FPVER=7.1
SET OLDPATH=%PATH%
IF NOT "%OS%"=="Windows_NT" GOTO NOTNT
:: VARIABLES
SET FLAV=ULTRA
SET VIEWER=NO
SET LOGIT=YES
SET FPLOCATION=C:\FASTPUSH
SET SHORTCUT=NO
SET MACREP=YES
SET SERVICE=YES
SET CMDCHECK=YES
SET CMDARRAY=8
SET SCAN=XCMD REG REGDIR REGINI RMTSHARE SC SHORTCUT TIMEOUT
SET TEST=NO
SET USE=NO
SET LOGON=
SET PASS=
SET LOGVALUE=
SET DRIVE=
SET SHARE=
SET FORCE=
SET SHAREFAIL=
SET WARNING=NO
SET CURRENTPATH=.
SET NEWPATH=
SET FOLDER=
SET PROGFILES=
SET REMOVE=NO
SET CONFIGFILE=NO
SET REMOTETARGET=
SET REG=NO
SET STARTPATH=
SET REMOTEDESK=
SET COMMONDESK=
SET TARGETPC=
SET LNKFOLDER=
SET MISSING=NO
SET PASSFLAG=NO
SET PSEXEC=YES
SET PING=YES
SET OPROGFILES=
:: *** FIND THE COMMAND OPTIONS ***
IF "%1" == "" GOTO HELP
IF "%1" == "/?" GOTO HELP
SET TEST=/?
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" GOTO HELP
SET TEST=/EXAMPLES
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" GOTO EXAMPLES
SET TEST=/REG
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET REG=YES
SET TEST=/REMOVE
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET REMOVE=YES
SET TEST=/UNINSTALL
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET REMOVE=YES
SET TEST=/NOVIEW
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET VIEWER=NO
SET TEST=/WARNING
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET WARNING=YES
SET TEST=/LOG
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET LOGIT=YES
SET TEST=/NOSHORTCUT
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET SHORTCUT=NO
SET TEST=/MANUAL
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET SERVICE=NO
SET TEST=/PWD
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET PASSFLAG=YES
SET TEST=/PSEXEC
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET PSEXEC=YES
SET TEST=/NOPING
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %1%2%3%4%5%6%7%8%9^|FIND /I /C "%TEST%"') DO @SET PV=%%P
IF "%PV%"=="1" SET PING=NO
IF "%2"=="/USER" GOTO USER2
IF "%3"=="/USER" GOTO USER3
IF "%4"=="/USER" GOTO USER4
IF "%5"=="/USER" GOTO USER5
IF "%6"=="/USER" GOTO USER6
IF "%7"=="/USER" GOTO USER7
IF "%8"=="/USER" GOTO USER8
GOTO CUSTOMINI
:USER2
SET USE=YES
SET LOGON=%3
SET PASS=%4
GOTO CUSTOMINI
:USER3
SET USE=YES
SET LOGON=%4
SET PASS=%5
GOTO CUSTOMINI
:USER4
SET USE=YES
SET LOGON=%5
SET PASS=%6
GOTO CUSTOMINI
:USER5
SET USE=YES
SET LOGON=%6
SET PASS=%7
GOTO CUSTOMINI
:USER6
SET USE=YES
SET LOGON=%7
SET PASS=%8
GOTO CUSTOMINI
:USER7
SET USE=YES
SET LOGON=%8
SET PASS=%9
GOTO CUSTOMINI
:: *** PICK UP A CUSTOM VNC INSTALLATION HERE ***
:: LOOKING FOR THE NEW CONFIG FILE WILL BE DONE AFTER THE PATH SEARCHING ROUTINE LATER.
:CUSTOMINI
:: IF "%CONFIGFILE%"=="NO" GOTO HEADER
IF "%2"=="/CUSTOM" SET CONFIGFILE=%3
IF "%3"=="/CUSTOM" SET CONFIGFILE=%4
IF "%4"=="/CUSTOM" SET CONFIGFILE=%5
IF "%5"=="/CUSTOM" SET CONFIGFILE=%6
IF "%6"=="/CUSTOM" SET CONFIGFILE=%7
IF "%7"=="/CUSTOM" SET CONFIGFILE=%8
IF "%8"=="/CUSTOM" SET CONFIGFILE=%9
IF "%2"=="/CONFIG" SET CONFIGFILE=%3
IF "%3"=="/CONFIG" SET CONFIGFILE=%4
IF "%4"=="/CONFIG" SET CONFIGFILE=%5
IF "%5"=="/CONFIG" SET CONFIGFILE=%6
IF "%6"=="/CONFIG" SET CONFIGFILE=%7
IF "%7"=="/CONFIG" SET CONFIGFILE=%8
IF "%8"=="/CONFIG" SET CONFIGFILE=%9
GOTO HEADER
:USER8
ECHO.
ECHO COMMAND LINE TOO LONG!
REM *** THE HELP SCREEN ***
:HELP
CLS
ECHO /****************************************************************************\
ECHO VNC INSTALLER SCRIPT %FPVER% (c) 2003, RICHARD HARRIS [UPDATED BY JASON SMYTH]
ECHO *----------------------------------------------------------------------------*
ECHO * VNC (REMOTE NT BOX) (/TEST) (/USER USER PASSWORD) *
ECHO *----------------------------------------------------------------------------*
ECHO * (REMOTE NT WORKSTATION NAME) MUST NOT BEGIN WITH \\ AND IF IT IS A PURE *
ECHO * NUMBER ADDRESS, YOU SHOULD USE THE PC'S FULL DOMAIN NAME. *
ECHO * *
ECHO * /USER (NAME) (PASSWORD) = CONNECT WITH THESE LOGIN CREDITIALS. *
ECHO * /PWD = ENCRYPT GIVEN PASSWORD INTO VNC SETTINGS *
ECHO * /REG = NO FILE INSTALL, JUST UPDATE THE REGISTRY *
ECHO * *
ECHO * /UNINSTALL OR /REMOVE = DELETES SERVICE, FILES AND REGISTRY KEYS *
ECHO * *
ECHO * /NOVIEW = DO NOT INSTALL VNCVIEWER TO THE CLIENT *
ECHO * /LOG = LOG RESULTS TO CURRENT DIR IN RESULTS.TXT *
ECHO * /CONFIG = USE THIS CONFIG FILE FROM SCRIPT'S FOLDER *
ECHO * /NOSHORTCUT = DO NOT CREATE START MENU LINKS ON TARGET *
ECHO * /MANUAL = SET SERVICE TO NOT START AUTOMATICALLY *
ECHO * *
ECHO * FOR EXAMPLES TRY VNC /EXAMPLES HTTP://WWW.DARKAGE.CO.UK/ *
ECHO \****************************************************************************/
GOTO END
:EXAMPLES
CLS
ECHO /****************************************************************************\
ECHO VNC INSTALLER SCRIPT %FPVER% (c) 2003, RICHARD HARRIS [UPDATED BY JASON SMYTH]
ECHO *----------------------------------------------------------------------------*
ECHO * VNC SERVER2 /NOVIEW = INSTALL VNC BUT NOT THE VIEWER *
ECHO * *
ECHO * VNC JOE /REG /CONFIG D:\PS.INI = DO NOT INSTALL ANY FILES BUT DELETE AND *
ECHO * UPDATE VNC SETTINGS WITH THE NEW INI FILE *
ECHO * *
ECHO * VNC JOE /REG = DO NOT INSTALL ANY FILES. OVERWRITE *
ECHO * EXISTING SETTINGS WITH COMMON SETTINGS *
ECHO * *
ECHO * VNC FREDS_PC /UNINSTALL = REMOVE VNC SERVICE, REG KEYS AND FILES *
ECHO * *
ECHO * VNC FREDS_PC /UNINSTALL /USER ENGINEER LETMEIN *
ECHO * = AS ABOVE, EXCEPT ATTACH AS THAT USER *
ECHO * *
ECHO * VNC SMTP-MAIL /CONFIG SERV.INI = USE A CUSTOM REGINI FILE FROM THE FASTPUSH*
ECHO * FOLDER INSTEAD OF MACHINE.INI *
ECHO * *
ECHO * VNC SMTP2 /CONFIG D:\SERV.INI = USE A CUSTOM FILE FROM THE SPECIFIED PATH *
ECHO * *
ECHO * VNC USER4 /WARNING = INSTALL WARNING BOX *
ECHO * HTTP://WWW.DARKAGE.CO.UK/ *
ECHO \****************************************************************************/
GOTO END
:: *** PRINT OUT A QUICK BOILER PLATE ***
:HEADER
SET TARGETPC=%1
IF "%REMOVE%"=="YES" (ECHO.& ECHO *** REMOVING VNC FROM %TARGETPC% *** & GOTO PATHTEST)
ECHO.
ECHO SCRIPT IS VERSION %FPVER%
ECHO ---------------------------------------------------------------
ECHO YOU WANT TO INSTALL : %FLAV%
IF "%USE%"=="NO" ECHO LOG ON AS : %USERNAME%
IF "%USE%"=="YES" ECHO LOG ON AS : %LOGON%
ECHO LOG OUTPUT TO RESULTS.TXT : %LOGIT%
ECHO INSTALL WARNING BOX : %WARNING%
IF NOT "%CONFIGFILE%"=="NO" ECHO USE VNC REG SETTINGS FROM : %CONFIGFILE%
IF "%REG%"=="YES" ECHO INSTALL METHOD : LEAVE FILES, OVERWRITE REGISTRY
IF "%REG%"=="NO" ECHO INSTALL METHOD : OVERWRITE FILES AND REGISTRY
ECHO INSTALL VNCVIEWER PROGRAM : %VIEWER%
ECHO MY DETAILS START MENU ICON : %MACREP%
ECHO ---------------------------------------------------------------
:: *** CHECK WHAT DIRECTORY THE SCRIPT IS IN AND ADJUST THE PATH ***
:: *** CHECK TO SEE IF THE PATH HAS BEEN ADDED PREVIOUSLY ***
:: *** ADD UTILS TO FRONT OF PATH. THIS MAKES SURE CORRECT PROGS ARE CALLED ***
:PATHTEST
ECHO.
SET OLDPATH=%PATH%
FOR /F "TOKENS=*" %%I IN ('CD') DO SET CURRENTPATH=%%I
:PATHCHECK
:: *** ADD UTILS TO PATH REGARDLESS OF OPTIONS ***
SET TEST=\\
FOR /F "TOKENS=* DELIMS= " %%P IN ('ECHO %FPLOCATION%^|FIND /I /C "%TEST%"') DO @SET PUSHD=%%P
IF "%PUSHD%"=="1" (
ECHO FPLOCATION SET TO UNC PATH
ECHO WILL USE PUSHD TO LINK TO DIRECTORY
PUSHD %FPLOCATION%
FOR /F "TOKENS=*" %%I IN ('CD') DO SET CURRENTPATH=%%I
)
IF "%FPLOCATION%"=="" IF EXIST "%CURRENTPATH%\VNC.CMD" (
ECHO.
ECHO R1
ECHO VNC FOUND AND UPDATING PATH
SET FPLOCATION=%CURRENTPATH%
PATH="%CURRENTPATH%\UTILS";%PATH%
GOTO CFGCHECK
)
IF NOT "%FPLOCATION%"=="" IF EXIST "%FPLOCATION%\VNC.CMD" (
ECHO RESULT - R2
ECHO.
ECHO VNC FOUND IN %FPLOCATION%
SET CURRENTPATH=%FPLOCATION%
GOTO CFGCHECK
)
IF "%FPLOCATION%"=="" IF NOT EXIST "%CURRENTPATH%\VNC.CMD" (
ECHO.
ECHO ERROR CODE - R3
ECHO VNC IS NOT IN THE CURRENT FOLDER AND NO FPLOCATION WAS SET.
ECHO EITHER CD INTO A FOLDER CONTAINING VNC OR SET FPLOCATION.
GOTO END
)
PAUSE
GOTO END
:CFGCHECK
ECHO PATH STATEMENT HAS BEEN BACKED UP AND WILL BE RESTORED AT THE END OF THE SCRIPT
IF "%CONFIGFILE%"=="NO" GOTO CMDCHECK
:: *** IF THERE'S NO CONFIGFILE SET, THEN SKIP ON TO THE UNC ROUTINE ***
ECHO.
IF "%CONFIGFILE%"=="NO" GOTO UNC
IF EXIST "%CONFIGFILE%" ECHO CONFIG FILE FOUND AND WILL BE USED BY REGINI TO INSTALL CUSTOM SETTINGS. & GOTO UNC
IF NOT EXIST "%CURRENTPATH%\%CONFIGFILE%" GOTO CUSTOMERROR
ECHO "%CURRENTPATH%\%CONFIGFILE%" WILL BE USED BY REGINI TO INSTALL CUSTOM VNC SETTINGS.
GOTO CMDCHECK
:CUSTOMERROR
ECHO.
ECHO ********************************************************************
ECHO * ERROR! THE CUSTOM SETTINGS FILE CANNOT BE FOUND. PLEASE PLACE *
ECHO * IT IN THE SAME FOLDER AS FASTPUSH AND DO NOT SPECIFY A FULL PATH *
ECHO ********************************************************************
GOTO END
:: *** UTILITY EXIST CHECK ROUTINE ***
:CMDCHECK
:: SCAN VARIABLE INCLUDES THE FILE NAMES OF EACH UTIL TO CHECK FOR
IF "%CMDCHECK%"=="NO" GOTO UNC
ECHO CHECKING UTILITY AVAILABILITY... PLEASE WAIT.
:: *** CALLING THE CHKCOUNT ROUTINE AT THE END OF THE SCRIPT ***
FOR /L %%G IN (1,1,%CMDARRAY%) DO @CALL :CHKCOUNT %%G
IF "%MISSING%"=="YES" GOTO UTILFAIL
ECHO.
:UNC
:: *** CHECK TO SEE THAT THE TARGET NAME ISN'T AN UNC ***
SET WSNAME=
FOR /F "TOKENS=1,*" %%I IN ('ECHO %TARGETPC%^|FIND /I "\\"') DO @SET WSNAME=%%I
IF "%WSNAME%"=="%TARGETPC%" ECHO. & ECHO WORKSTATION NAME CONTAINS BACKSLASHES. ATTEMPTING REMOVAL. & SET TARGETPC=%WSNAME:~2,30%
ECHO TARGET PC WILL BE '%TARGETPC%'.
IF "%WSNAME%"=="%TARGETPC%" GOTO HELP
IF "%WSNAME%"=="" ECHO MACHINE NAME "%TARGETPC%" IS VALID.
:: *** PING THE TARGET MACHINE TO SEE IF IS ACTIVE ***
:: *** CHECKS FOR TTL AS THIS IS INTERNATIONAL ***
IF "%PING%"=="NO" (
ECHO.
ECHO SKIPPING PING AS REQUESTED
GOTO VNCPASSWD
)
ECHO.
ECHO PLEASE WAIT WHILE THE TCP/IP CONNECTION ON %TARGETPC% IS TESTED.
SET TARGETSTATUS=
FOR /F "SKIP=3 TOKENS=6" %%G IN ('PING %TARGETPC%^|FIND /I "TTL"') DO @SET TARGETSTATUS=%%G
IF "%TARGETSTATUS%"=="" ECHO MACHINE "%TARGETPC%" IS NOT PINGABLE VIA IP & GOTO NOIP
IF NOT "%TARGETSTATUS%"=="" ECHO MACHINE "%TARGETPC%" IS ALIVE, SCRIPT CONTINUING & GOTO VNCPASSWD
ECHO FAIL ON PING TEST?
GOTO END
:VNCPASSWD
IF NOT "%PASSFLAG%"=="YES" GOTO :CONNECTING
ECHO.
ECHO FASTPUSH WILL ENCRYPT AND USE THE PASSWORD YOU SUPPLIED.
ECHO WARNING! THIS WILL OVERRIDE ANY PASSWORD SET IN MACHINE.INI OR ELSEWHERE
IF "%2"=="/PWD" SET VNCPASS=%3
IF "%3"=="/PWD" SET VNCPASS=%4
IF "%4"=="/PWD" SET VNCPASS=%5
IF "%5"=="/PWD" SET VNCPASS=%6
IF "%6"=="/PWD" SET VNCPASS=%7
IF "%7"=="/PWD" SET VNCPASS=%8
IF "%8"=="/PWD" SET VNCPASS=%9
SET PASSTEST=A%VNCPASS%A
IF "%PASSTEST%"=="AA" GOTO PWDFAIL
IF EXIST "%FPLOCATION%\%TARGETPC%PASS.INI" DEL "%FPLOCATION%\%TARGETPC%PASS.INI"
"%FPLOCATION%\UTILS\VNCENC" %VNCPASS% > "%FPLOCATION%\%TARGETPC%PASS.INI"
: *** LOG ON TO THE REMOTE PC ***
:CONNECTING
IF "%USE%"=="YES" GOTO CUSTOMLOGON
NET USE \\%TARGETPC%\IPC$
GOTO IPCSTATUS
:CUSTOMLOGON
ECHO.
ECHO USING PROVIDED LOGIN INFORMATION
NET USE \\%TARGETPC%\IPC$ /USER:%LOGON% %PASS%
:: *** CHECK TO SEE IF THE IPC NULL SESSION WAS ESTABLISHED ***
:: *** GETRENNT IS GERMAN FOR DISCONENCTED ***
:IPCSTATUS
SET IPC=
FOR /F "TOKENS=1,*" %%I IN ('NET USE^|FIND /I "\\%TARGETPC%\IPC$"') DO @SET IPC=%%I
IF "%IPC%"=="OK" GOTO SHARECHECK
IF "%IPC%"=="GETRENNT" GOTO SHARECHECK
IF "%IPC%"=="DISCONNECTED" GOTO SHARECHECK
IF "%IPC%"=="" GOTO DRIVEFAIL
ECHO FAIL UNDER IPCSTATUS
GOTO END
:: *** READ REMOTE PC'S SHARES AND WORK OUT WHICH DRIVE NT LIVES ON *** @@
:SHARECHECK
ECHO CHECKING SHARE ACCESS ON %TARGETPC%
:: FOR /F "TOKENS=2* DELIMS= " %%A IN ('REG QUERY "HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\SYSTEMROOT" \\%TARGETPC%') DO SET SHARE=%%B
:: FOR /F "TOKENS=1* DELIMS=:\" %%I IN ('ECHO %SHARE%^|FIND /I ":"') DO @SET REMOTETARGET=%%I
:: FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\SYSTEMROOT" \\%TARGETPC%') DO SET FOLDER=%%D
:: FOR /F "TOKENS=2 DELIMS=:\" %%G IN ('REG QUERY "HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\PROGRAMFILESDIR" \\%TARGETPC%') DO SET PROGFILES=%%G
FOR /F "TOKENS=2* DELIMS= " %%A IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /V SYSTEMROOT') DO SET SHARE=%%B
FOR /F "TOKENS=1* DELIMS=:\" %%I IN ('ECHO %SHARE%^|FIND /I ":"') DO @SET REMOTETARGET=%%I
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /V SYSTEMROOT') DO SET FOLDER=%%D
FOR /F "TOKENS=2 DELIMS=:\" %%G IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION" /V PROGRAMFILESDIR') DO SET OPROGFILES=%%G
:: SET PROGFILES FOR THE OLD VNC VERSION
SET PROGFILES=%OPROGFILES%\ORL\VNC
ECHO QUERYING REMOTE PC %TARGETPC% TO LOCATE THE START MENU. PLEASE WAIT.
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V "COMMON PROGRAMS"') DO SET COMMONPROGS=%%D
SET STARTPATH=\\%TARGETPC%\%REMOTETARGET%$\%COMMONPROGS%
:: DON'T USE QUOTES ON THE PROGFILES VARIABLE, IT GETS UPSET!
ECHO WINDOWS (ON MACHINE %TARGETPC%) IS ON DRIVE %REMOTETARGET% IN %FOLDER% AND VNC WILL BE
ECHO INSTALLED INTO %REMOTETARGET%:\%PROGFILES% ON %TARGETPC%.
IF "%REMOTETARGET%"=="" GOTO REGFAIL
GOTO NETUSE
:REGFAIL
REM *** NO ADMIN SHARE WAS FOUND, SO EXIT GRACEFULLY ***
ECHO ***************************************************************************
ECHO * SCRIPT COULD NOT FIND WHERE NT IS INSTALLED ON THE REMOTE MACHINE. *
ECHO * TRY USING THE MACHINE'S IP ADDRESS RATHER THAN IT'S NAME FOR THE TARGET *
ECHO ***************************************************************************
ECHO.
ECHO THE COMMAND WAS:
ECHO REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION" /V SYSTEMROOT
ECHO.
ECHO CHECK THAT YOU ARE USING REG VERSION 3 (INCLUDED IN XP SYSTEM) AND NOT AN EARLIER EDITION.
GOTO CLEANUP
:: *** MAKE A LINK TO THE REMOTE PC AND RECREATE DRIVE SHARE IF NECESSARY ***
:NETUSE
IF EXIST \\%TARGETPC%\%REMOTETARGET%$\*.* GOTO INSTALLCHECK
ECHO THE %REMOTETARGET%$ SHARE WAS UNAVAILABLE. ATTEMPTING TO RECRATE IT.
ECHO RMTSHARE \\%TARGETPC%\%REMOTETARGET%$=%REMOTETARGET%:\
RMTSHARE \\%TARGETPC%\%REMOTETARGET%$=%REMOTETARGET%:\
IF EXIST \\%TARGETPC%\%REMOTETARGET%$\*.* GOTO INSTALLCHECK
GOTO DRIVEFAIL
:INSTALLCHECK
:: *** CHECK FOR EXISTING VNC INSTALL AND IF NECESSARY, KILL THE SERVICE ***
SET VNCSTATE=
ECHO.
FOR /F "TOKENS=4 DELIMS= " %%I IN ('SC \\%TARGETPC% QUERY WINVNC^|FIND /I "STATE"') DO @SET VNCSTATE=%%I
IF "%VNCSTATE%"=="RUNNING" (ECHO VNC3 IS RUNNING ON %TARGETPC%.&GOTO STOPSERVICE)
IF "%VNCSTATE%"=="" (ECHO THE VNC3 SERVICE IS NOT ACTIVE ON %TARGETPC%. CONTINUING WITH SCRIPT.&GOTO :VNC4STATE)
IF "%VNCSTATE%"=="STOPPED" GOTO DELETESERVICE
IF "%VNCSTATE%"=="STOP_PENDING" ECHO *** WARNING! SERVICE HAS HUNG ON STOP. SUGGEST REMOTE REBOOT OR PSKILL. SCRIPT WILL NOW END *** & GOTO END
ECHO VNC3 FAIL ON SERVICE STATE?
:VNC4STATE
FOR /F "TOKENS=4 DELIMS= " %%I IN ('SC \\%TARGETPC% QUERY WINVNC4^|FIND /I "STATE"') DO @SET VNC4STATE=%%I
IF "%VNC4STATE%"=="RUNNING" (ECHO VNC4 IS RUNNING ON %TARGETPC%.&GOTO STOPSERVICE)
IF "%VNC4STATE%"=="" (ECHO THE VNC4 SERVICE IS NOT ACTIVE ON %TARGETPC%. CONTINUING WITH SCRIPT.&GOTO :CHOOSEVNC)
IF "%VNC4STATE%"=="STOPPED" GOTO DELETESERVICE
IF "%VNC4STATE%"=="STOP_PENDING" ECHO *** WARNING! VNC4 SERVICE HAS HUNG ON STOP. SUGGEST REMOTE REBOOT OR PSKILL. SCRIPT WILL NOW END *** & GOTO END
ECHO VNC4 FAIL ON SERVICE STATE?
GOTO END
:STOPSERVICE
ECHO STOPPING THE WINVNC SERVICE ON %TARGETPC%.
SC \\%TARGETPC% STOP WINVNC :: > NUL
ECHO. STOP PENDING
%FPLOCATION%\UTILS\TIMEOUT.EXE 8
:DELETESERVICE
ECHO DELETING THE WINVNC SERVICE ON %TARGETPC%.
SC \\%TARGETPC% DELETE WINVNC
ECHO DELETING PREVIOUS VNC REGISTRY KEYS FROM %TARGETPC%.
REG DELETE \\%TARGETPC%\HKLM\SOFTWARE\ORL /F > NUL
REG DELETE \\%TARGETPC%\HKU\.DEFAULT\SOFTWARE\ORL /F > NUL
REG DELETE \\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN /V WINVNC /F > NUL
REG DELETE \\%TARGETPC%\HKLM\SOFTWARE\ULTRAVNC /F > NUL
:: *** CHOOSE THE VNC FLAVOUR AND INSTALL AS NECESSARY ***
:CHOOSEVNC
SET TARGETPATH="\\%TARGETPC%\%REMOTETARGET%$\%PROGFILES%"
IF "%REMOVE%"=="YES" GOTO REMOVEVNC
IF "%REG%"=="YES" GOTO REGONLY
ECHO.
ECHO YOUR COMMAND LINE OPTION WAS TO INSTALL %FLAV%.
ECHO.
ECHO DESTINATION FOR INSTALLATION WILL BE %TARGETPATH%.
ECHO.
:: *** USE THE FLAVOUR VARIABLE TO PICK THE RIGHT SOURCE FOLDER FOR VNC ***
IF NOT EXIST %TARGETPATH% MD %TARGETPATH%
IF EXIST %TARGETPATH% ECHO DIRECTORY %TARGETPATH% EXISTS.
ECHO COPY FILES TO %TARGETPATH% FROM %CURRENTPATH%\%FLAV%.
SET COPYCMD=/Y
IF EXIST "%TARGETPATH%\VNCHOOKS.DLL" RENAME "%TARGETPATH%\VNCHOOKS.DLL" VNCHOOKS.OLD
IF EXIST "%TARGETPATH%\VNCHOOKS.OLD" DEL "%TARGETPATH%\VNCHOOKS.OLD"
XCOPY "%CURRENTPATH%\%FLAV%\*.DLL" %TARGETPATH% /F /R /V
XCOPY "%CURRENTPATH%\%FLAV%\WINVNC.EXE" %TARGETPATH% /F /R /V
XCOPY "%CURRENTPATH%\%FLAV%\VNCHOOKS.REG" %TARGETPATH% /F /R /V
:: AD AUTHENTICATED DLLS FOR ULTRAVNC
ECHO AD
IF EXIST "%CURRENTPATH%\%FLAV%\AU*.DLL" XCOPY "%CURRENTPATH%\%FLAV%\AU*.DLL" %TARGETPATH% /F /R /V
IF "%MACREP%"=="YES" XCOPY "%CURRENTPATH%\COMMON\MYDETAILS.BAT" "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\MYDETAILS.BAT" /F /R /V
IF "%MACREP%"=="YES" XCOPY "%CURRENTPATH%\COMMON\My Details.lnk" "%STARTPATH%\.." /F /R /V
IF EXIST "%CURRENTPATH%\%FLAV%\Z*.DLL" XCOPY "%CURRENTPATH%\%FLAV%\Z*.DLL" %TARGETPATH% /F /R /V
IF "%VIEWER%"=="YES" XCOPY "%CURRENTPATH%\%FLAV%\VNCVI*.EXE" %TARGETPATH% /F /R /V
GOTO WHATCONFIG
:REGONLY
ECHO ******************************************************************
ECHO * NOT UPDATING CLIENT FILES - ONLY THE REGISTRY. *
ECHO * THIS MAY BE USED WITH THE /CONFIG OPTION FOR MORE FLEXIBILITY. *
ECHO ******************************************************************
:WHATCONFIG
:: *** CHECK FOR CUSTOM INSTALL, IF SO DO IT AND SKIP ON ***
IF "%CONFIGFILE%"=="NO" GOTO DEFAULTVNC
ECHO.
ECHO *******************************************************************************
ECHO * WARNING! YOU ARE ABOUT TO USE YOUR OWN REGISTRY INI FILE TO CONTROL VNC *
ECHO * UNLESS ALL SETTINGS ARE CORRECT, THE SERVICE MAY NOT START AND *
ECHO * YOU MAY DAMAGE THE REGISTRY OF THE REMOTE COMPUTER *
ECHO * *
ECHO * ONLY USE INI FILES THAT HAVE BEEN CREATED BY EXPORTING THE KEYS WITH REGDIR *
ECHO * EG: REGDIR \REGISTRY\MACHINE\SOFTWARE\ORL\WINVNC3\DEFAULT > C:\TEST.INI *
ECHO * *
ECHO * RERUN THIS SCRIPT WITH /REMOVE WILL DELETE VNC AND THE EXISTING STANDARD *
ECHO * KEYS AS REGINI WILL NOT REPLACE EXISTING REGISTRY ENTRIES *
ECHO * *
ECHO * FASTPUSH WILL CHECK IT'S OWN FOLDER FOR A CONFIG FILE FIRST AND THEN CHECK *
ECHO * A LISTED PATH SECOND. *
ECHO *******************************************************************************
%FPLOCATION%\UTILS\TIMEOUT.EXE 10
IF EXIST "%CONFIGFILE%" GOTO INFOLDER
IF EXIST "%CURRENTPATH%\%CONFIGFILE%" GOTO FROMPATH
ECHO ERROR ON PATH CHECKER
GOTO END
:INFOLDER
ECHO USING : REGINI -M \\%TARGETPC% "%CONFIGFILE%"
REGINI -M \\%TARGETPC% "%CONFIGFILE%"
%FPLOCATION%\UTILS\TIMEOUT.EXE 10
GOTO NEWPASS
:FROMPATH
ECHO USING : REGINI -M \\%TARGETPC% "%CURRENTPATH%\%CONFIGFILE%"
REGINI -M \\%TARGETPC% "%CURRENTPATH%\%CONFIGFILE%"
%FPLOCATION%\UTILS\TIMEOUT.EXE 10
GOTO NEWPASS
:: *** INSTALL THE DEFAULT VNC SETTINGS ***
:DEFAULTVNC
ECHO.
ECHO INSTALLING THE DEFAULT SETTINGS FOR VNC INTO THE REMOTE REGISTRY. PLEASE WAIT.
ECHO REGINI -M \\%TARGETPC% "%CURRENTPATH%\COMMON\MACHINE.INI"
REGINI -M \\%TARGETPC% "%CURRENTPATH%\COMMON\MACHINE.INI" > NUL
:: *** ALLOW FOR CUSTOM REGISTRY SETTINGS ***
:: *** IF A FILE THAT MATCHES THE MACHINE NAME EXISTS, COPY THIS INTO THE REGISTRY. ***
:: *** THIS ALLOWS DIFFERENT PASSWORDS, IP RESTRICTION, ETC. SUGGESTED BY RYAN CASEY ***
IF EXIST "%CURRENTPATH%\COMMON\%TARGETPC%.INI" REGINI -M \\%TARGETPC% "%CURRENTPATH%\COMMON\%TARGETPC%.INI" > NUL
:NEWPASS
IF NOT "%PASSFLAG%"=="YES" GOTO :INSTALLHELPER
ECHO *** USING COMMAND LINE SPECIFIED VNC PASSWORD ***
ECHO *** THIS WILL OVERRIDE ANY SET IN A CUSTOM INI FILE ***
REGINI -M \\%TARGETPC% "%FPLOCATION%\%TARGETPC%PASS.INI"
DEL "%FPLOCATION%\%TARGETPC%PASS.INI"
GOTO INSTALLHELPER
:INSTALLHELPER
:: *** THE INST ROUTINE INSTALLS THE VNC SERVICE AND HELPER ***
ECHO.
ECHO INSTALLING WINVNC TO %REMOTETARGET%:\%PROGFILES%
:: SET IF YOU WANT THE SERVICE TO BE A MANUAL START - CHANGE AUTO TO MANUAL
IF "%SERVICE%"=="YES" SC \\%TARGETPC% CREATE WINVNC BINPATH= "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE -SERVICE" TYPE= OWN TYPE= INTERACT START= AUTO
IF "%SERVICE%"=="NO" SC \\%TARGETPC% CREATE WINVNC BINPATH= "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE -SERVICE" TYPE= OWN TYPE= INTERACT START= DEMAND
:: *** INSTALL THE SERVICE HELPER TO THE REMOTE REGISTRY ***
IF EXIST "%CURRENTPATH%\PATH.TMP" DEL "%CURRENTPATH%\PATH.TMP"
IF EXIST "%CURRENTPATH%\HELPER.INI" DEL "%CURRENTPATH%\HELPER.INI"
ECHO.
ECHO SETTING VNC HELPER IN HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN TO:
ECHO WINVNC = "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -SERVICEHELPER
ECHO WINVNC = "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -SERVICEHELPER> %CURRENTPATH%\PATH.TMP
COPY "%CURRENTPATH%\COMMON\HELPER.INI" + "%CURRENTPATH%\PATH.TMP" "%CURRENTPATH%\HELPER.TMP" > NUL
REGINI -M \\%TARGETPC% "%CURRENTPATH%\HELPER.TMP"
DEL "%CURRENTPATH%\*.TMP"
GOTO STARTSERVER
:STARTSERVER
:: *** FIRE UP THE SERVICE ***
ECHO ATTEMPTING TO START THE SERVICE.....
IF "%SERVICE%"=="YES" SC \\%TARGETPC% START WINVNC
IF "%SERVICE%"=="NO" ECHO.& ECHO FASTPUSH WILL START THE REMOTE WINVNC SERVICE, BUT IT WILL NOT SURVIVE A REBOOT. & SC \\%TARGETPC% START WINVNC
:MAKESHORTS
:: *** SHORTCUT CREATION ROUTINE ***
ECHO.
IF "%SHORTCUT%"=="NO" ECHO SKIPPED START MENU SHORTCUT CREATION & GOTO SUCCESS
IF "%SHORTCUT%"=="YES" ECHO BEGINNING START MENU SHORTCUT CREATION
ECHO.
ECHO SCRIPT WILL ATTEMPT TO CREATE VNC ICONS UNDER:
ECHO '%STARTPATH%\VNC'.
IF EXIST "%STARTPATH%\VNC" RD "%STARTPATH%\VNC" /Q /S | ECHO DELETED EXISTING VNC START MENU OPTIONS.
:: *** READ THE REG AND WORK OUT WHERE THE ALL USERS' DESKTOP IS ***
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V "COMMON DESKTOP"') DO SET COMMONDESK=%%D
SET REMOTEDESK=\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%
:: *** CREATE A BATCH FILE TO CREATE SHORTCUTS ON REMOTE PC ***
IF EXIST "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD" DEL /Q "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
IF NOT EXIST "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\SHORTCUT.EXE" COPY "%FPLOCATION%\UTILS\SHORTCUT.EXE" "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32"
ECHO @ECHO OFF>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
IF EXIST "%STARTPATH%\REALVNC\*.*" RD "%STARTPATH%\REALVNC" /S /Q
IF NOT EXIST "%STARTPATH%\VNC" MKDIR "%STARTPATH%\VNC"
IF NOT EXIST "%STARTPATH%\VNC\VNC SERVER" MKDIR "%STARTPATH%\VNC\VNC SERVER"
IF NOT EXIST "%STARTPATH%\VNC\VNC VIEWER" MKDIR "%STARTPATH%\VNC\VNC VIEWER"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\VNCVIEWER.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\RUN VNC VIEWER" -D "%REMOTETARGET%:\%PROGFILES%">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\RUN VNC SERVER" -D "%REMOTETARGET%:\%PROGFILES%">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\ADD NEW CLIENT" -D "%REMOTETARGET%:\%PROGFILES%" -A "-CONNECT">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\REGISTER VNC SERVER SERVICE" -D "%REMOTETARGET%:\%PROGFILES%" -A "-INSTALL">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\RUN SERVICE HELPER" -D "%REMOTETARGET%:\%PROGFILES%" -A "-SERVICEHELPER">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\SHOW ABOUT BOX" -D "%REMOTETARGET%:\%PROGFILES%" -A "-ABOUT">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\SHOW DEFAULT PROPERTIES" -D "%REMOTETARGET%:\%PROGFILES%" -A "-DEFAULTSETTINGS">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\SHOW USER PROPERTIES" -D "%REMOTETARGET%:\%PROGFILES%" -A "-SETTINGS">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\WINVNC.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC SERVER\UNREGISTER VNC SERVICE" -D "%REMOTETARGET%:\%PROGFILES%" -A "-REMOVE">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\VNCVIEWER.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC VIEWER\LISTENING VNC VIEWER" -D "%REMOTETARGET%:\%PROGFILES%" -A "-LISTEN" >>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%PROGFILES%\VNCVIEWER.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\VNC VIEWER\REGISTER VIEWER WITH SAVED SESSIONS" -D "%REMOTETARGET%:\%PROGFILES%" -A "-REGISTER">>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
:: *** IF REPORTING OPTION IS ON, CREATE A DESKTOP LINK SO USERS CAN FIND OUT WHAT BOX THEY'RE USING ***
IF "%MACREP%" NEQ "YES" GOTO RUNICONS
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%FOLDER%\SYSTEM32\MYDETAILS.EXE" -N "%REMOTETARGET%:\%COMMONDESK%\MY DETAILS" >>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
ECHO SHORTCUT -F -T "%REMOTETARGET%:\%FOLDER%\SYSTEM32\MYDETAILS.EXE" -N "%REMOTETARGET%:\%COMMONPROGS%\VNC\MY DETAILS" >>"\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD"
:: *** EXECUTE BATCH FILE ON REMOTE COMPUTER ***
:RUNICONS
ECHO.
IF "%PSEXEC%"=="YES" PSEXEC \\%TARGETPC% "%REMOTETARGET%:\%FOLDER%\ICONS.CMD"
IF NOT "%PSEXEC%"=="YES" XCMD \\%TARGETPC% "%REMOTETARGET%:\%FOLDER%\ICONS.CMD"
:: XCMD NOT DOES SEEM AS RELIABLE FOR SOME REASON - INVESTIGATE
:: XCMD \\%TARGETPC% "%REMOTETARGET%:\%FOLDER%\ICONS.CMD"
GOTO REM%ERRORLEVEL%
:: GOTO :SUCCESS
:REM0
ECHO.
ECHO ICONS COMMAND EXCUTED ON REMOTE MACHINE %TARGETPC%
ECHO DEL "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\ICONS.CMD" /Q
GOTO SUCCESS
:REM1
ECHO.
ECHO *** WARNING! ***
ECHO ICONS COMMAND FAILED!! INVESTIGATE %TARGETPC%.
GOTO SUCCESS
:REM-1
ECHO.
ECHO *** WARNING! ***
ECHO ICONS COMMAND FAILED!! INVESTIGATE %TARGETPC%.
GOTO SUCCESS
:REM128
ECHO.
ECHO *** WARNING! ***
ECHO XCMD SERVICE UNABLE TO BE INSTALLED. INVESTIGATE %TARGETPC%.
ECHO SHORTCUTS WERE NOT CREATED / UPDATED.
GOTO SUCCESS
ECHO END OF SHORTCUT CREATION SCHEME
GOTO SUCCESS
:FORCECHECK
IF NOT "%FORCE%"=="YES" GOTO DRIVEFAIL
RMTSHARE \\%TARGETPC%\%REMOTEDRIVE%$=%REMOTEDRIVE%:\
IF "%SHAREFAIL%"="YES" GOTO DRIVEFAIL
SET SHAREFAIL=YES
GOTO NETUSE
:: *** REMOVE THE VNC PROGRAM AND REGISTRY SETTINGS ***
:REMOVEVNC
ECHO.
ECHO YOUR COMMAND LINE OPTION WAS TO REMOVE VNC FROM %TARGETPC%.
ECHO.
ECHO VNC FILES AND HOST DIRECTORY WILL BE DELETED FROM %TARGETPATH%
ECHO THE REGISTRY ENTRIES WILL ALSO BE DELETED.
REM IAMHERE PSEXEC \\%TARGETPC% NET STOP WINVNC
IF EXIST "%TARGETPATH%\VNCHOOKS.DLL" DEL "%TARGETPATH%\VNCHOOKS.DLL" /Q /F
IF EXIST %TARGETPATH% RD %TARGETPATH% /Q /S | ECHO %TARGETPATH% FOLDER REMOVED.
IF EXIST "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\OMNITHREAD*.DLL" DEL "\\%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\OMNITHREAD*.DLL" /S
IF EXIST "%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\MY DETAILS.BAT" DEL "%TARGETPC%\%REMOTETARGET%$\%FOLDER%\SYSTEM32\MY DETAILS.BAT" /Q
IF EXIST "%STARTPATH%\..\MY DETAILS.LNK" DEL "%STARTPATH%\..\MY DETAILS.LNK" /Q | ECHO DELETED THE 'MY DETAILS' PROGRAM AND SHORTCUTS.
FOR /F "TOKENS=1* DELIMS=:\" %%C IN ('REG QUERY "\\%TARGETPC%\HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS" /V "COMMON DESKTOP"') DO SET COMMONDESK=%%D
SET REMOTEDESK=\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%
IF EXIST "\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%\MY DETAILS.LNK" ECHO DELETING THE MY DETAILS ICON FROM THE DESKTOP & DEL /Q "\\%TARGETPC%\%REMOTETARGET%$\%COMMONDESK%\MY DETAILS.LNK"
ECHO REMOVING \\%TARGETPC%\IPC$ LINK.
NET USE \\%TARGETPC%\IPC$ /DEL
SET LOGVALUE=KILLED
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:NOIP
ECHO.
ECHO *************************************************************************
ECHO * ERROR: IP ACCESS TO MACHINE IS NOT AVAILABLE! CHECK NETWORK AND POWER *
ECHO *************************************************************************
SET LOGVALUE=NOIP
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:EMPTY
ECHO.
ECHO *****************************************************
ECHO * ERROR! ECHO YOU HAVE NOT SPECIFIED A MACHINE NAME *
ECHO *****************************************************
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:NOTNT
ECHO.
ECHO ************************************************
ECHO * ERROR: ECHO THIS PROGRAM ONLY WORKS UNDER NT *
ECHO ************************************************
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:NOVNCCMD
ECHO.
ECHO ********************************************************************************
ECHO * ERROR: VNC.CMD FILE NOT FOUND WITH THE PATH SPECIFIED IN FPLOCATION VARIABLE *
ECHO ********************************************************************************
SET LOGVALUE=NOVNDCMD
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:DRIVEFAIL
ECHO.
ECHO *****************************************************************************
ECHO * ERROR: ECHO THERE WAS NO DRIVE MAPPED TO THE TARGET MACHINE'S SYSTEMDRIVE *
ECHO * TRY A MANUAL NET USE %NETDRV% \\MACHINE\DRIVE$ /USER:ADMIN_ACCOUNT *
ECHO * NB: MAKE SURE THE TARGET PC IS NOT A WINDOWS 9X OR LINUX BOX *
ECHO *****************************************************************************
SET LOGVALUE=DRIVEFAIL
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:UTILFAIL
ECHO.
ECHO *****************************************************************************
ECHO * ERROR: A UTILITY CRITICAL TO THE OPERATION OF FASTPUSH COULD NOT BE FOUND *
ECHO * PLEASE INSTALL THIS EXECUTEABLE INTO THE FASTPUSH\UTILS FOLDER *
ECHO *****************************************************************************
SET LOGVALUE=NOUTIL
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:PWDFAIL
ECHO.
ECHO *****************************************************************************
ECHO * ERROR: YOU SPECIFIED /PWD TO USE A CUSTOM VNC PASSWORD. HOWEVER YOU DID *
ECHO * NOT PROVIDE A PASSWORD AFTER USING THIS SWITCH. PLEASE TRY AGAIN. *
ECHO *****************************************************************************
SET LOGVALUE=NOPWD
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:SUCCESS
SET LOGVALUE=INSTALLED
GOTO CLEANUP
:: *** DELETE THE DRIVE MAPPING AND KILL THE IPC CONNECTION OFF TOO ***
:CLEANUP
NET USE \\%TARGETPC%\IPC$ /DEL > NUL
IF EXIST %NETDRV%: NET USE %NETDRV%: /DEL > NUL
ECHO ------------------------------------------------------------
ECHO FASTPUSH TO '%TARGETPC%'.
ECHO YOU WANT TO INSTALL : %FLAV%
IF "%USE%"=="YES" ECHO LOG ON AS : %LOGON%
IF "%USE%"=="YES" ECHO USE THIS PASSWORD : HIDDEN
IF "%LOG%"=="YES" ECHO LOGGING RESULTS TO RESULTS.TXT
IF "%WARNING%"=="YES" ECHO INSTALL WARNING BOX : YES
IF NOT "%CONFIGFILE%"=="NO" ECHO USE VNC REG SETTINGS FROM : %CONFIGFILE%
ECHO INSTALL VNCVIEWER PROGRAM : %VIEWER%
ECHO CREATE START MENU LINKS : %SHORTCUT%
ECHO ------------------------------------------------------------
IF "%LOGIT%"=="YES" GOTO LOGGING
GOTO END
:LOGGING
ECHO LOGGING RESULTS TO "%CURRENTPATH%\RESULTS.TXT"
:: *** PIPE THE TIME AND DATE INTO VARIABLES ***
FOR /F "TOKENS=2,*" %%I IN ('DATE/T') DO @SET ZDATE=%%I
FOR /F "TOKENS=1,*" %%J IN ('TIME/T') DO @SET ZCLOCK=%%J
:: *** IF RESULTS FILES DOESN'T EXIST, THEN MAKE ONE ***
IF NOT EXIST %CURRENTPATH%\RESULTS.TXT ECHO FASTPUSH INSTALLATION LOG (DATE / TIME / TARGET / RESULTS) > RESULTS.TXT
:: *** TIME, DATE, ETC. PIPED OUT TO TMP FILE ***
IF "%LOGVALUE%"=="INSTALLED" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : %FLAV% WAS INSTALLED TO %TARGETPC%. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOIP" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : ERROR: %TARGETPC% NOT PINGABLE. CHECK TCP/IP. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOREG" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : NT SYSTEM FOLDER NOT FOUND. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOSHARE" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : $ADMIN SHARE ON %TARGETPC% UNAVAILABLE. CHECK SHARES. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="DRIVEFAIL" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : FAILED TO LOGON TO %TARGETPC%. CHECK LOGON/SHARES. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="KILLED" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : VNC SERVICE AND FILES WERE REMOVED. > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOVNCCMD" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : VNC COMMAND FILE NOT FOUND. CHECK PATH VARIABLE > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOCMD" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : NO VALID COMMAND LINE OPTIONS WERE FOUND > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOUTIL" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : NO VALID COMMAND LINE OPTIONS WERE FOUND > "%CURRENTPATH%\RESULTS.TMP"
IF "%LOGVALUE%"=="NOPWD" ECHO %ZDATE% : %ZCLOCK% : %TARGETPC% : SPECIFIED /PWD BUT DID NOT SUPPLY A PASSWORD > "%CURRENTPATH%\RESULTS.TMP"
REN "%CURRENTPATH%\RESULTS.TXT" OLDRESULTS.TMP > NUL
COPY "%CURRENTPATH%\OLDRESULTS.TMP" + "%CURRENTPATH%\RESULTS.TMP" "%CURRENTPATH%\RESULTS.TXT" > NUL
DEL "%CURRENTPATH%\*.TMP" > NUL
GOTO END
:: *** INSERT CALLED PROCEDURES HERE ***
:: *** THEY WON'T BE RUN UNLESS CALLED DIRECTLY ***
:CHKCOUNT
:: *** PICK EACH ITEM FROM THE SCAN ARRAY ***
FOR /F "TOKENS=%1 DELIMS= " %%P IN ('ECHO %SCAN%') DO @CALL :CHKUTIL %%P
GOTO :EOF
:CHKUTIL
:: *** CHECK FOR THE EXISTANCE OF EACH COMPONENT ***
IF "%MISSING%"=="YES" GOTO :EOF
:: IF EXIST %CURRENTPATH%\UTILS\%1.EXE ECHO %1 OKAY.
IF NOT EXIST %CURRENTPATH%\UTILS\%1.EXE ECHO %1 NOT FOUND. PLEASE INSTALL %1 IN %CURRENTPATH%\UTILS. & SET MISSING=YES
GOTO :EOF
:END
:: *** END OF THE LINE ***
SET USER=
SET PASS=
SET VNCPASS=
IF "%PUSHD%"=="1" POPD
IF EXIST "%FPLOCATION%\%TARGETPC%PASS.INI" DEL "%FPLOCATION%\%TARGETPC%PASS.INI"
:: ECHO RESTORING OLD PATH TO "%OLDPATH%".
SET PATH=%OLDPATH%
----- vnc.cmd END -----
With this frontend batch file for installs:
----- vncinst.bat START -----
@echo off
IF "%1" == "" GOTO ERROR
IF "%2" == "" GOTO ERROR
IF "%3" == "" GOTO ERROR
cd c:\FastPush
call vnc %1 /user %1\%2 %3
psexec \\%1 -u %1\%2 -p %3 c:\windows\regedit.exe /q /s "c:\program files\orl\vnc\vnchooks.reg" >NUL
echo.
echo DONE
GOTO END
:ERROR
cls
echo.
echo Usage: vncinst [remote NT box] [local admin user name] [local admin password]
echo.
:END
----- vncinst.bat END -----
With this frontend batch file for uninstalls:
----- vncuninst.bat START -----
@echo off
IF "%1" == "" GOTO ERROR
IF "%2" == "" GOTO ERROR
IF "%3" == "" GOTO ERROR
:EXECUTE
cd c:\FastPush
call vnc %1 /user %1\%2 %3 /remove
ECHO.
ECHO DONE
GOTO END
:ERROR
cls
echo.
echo Usage: vncuninst [remote NT box] [local admin user name] [local admin password]
echo.
:END
----- vncuninst.bat END -----
A Batch file to restart the service:
----- startvnc.bat START -----
@echo off
IF "%1" == "" GOTO ERROR
IF "%2" == "" GOTO ERROR
IF "%3" == "" GOTO ERROR
FOR /F "TOKENS=2,*" %%I IN ('DATE/T') DO @SET ZDATE=%%I
FOR /F "TOKENS=1,*" %%J IN ('TIME/T') DO @SET ZCLOCK=%%J
cd c:\fastpush
cls
psexec \\%1 -u %1\%2 -p %3 net stop winvnc
psexec \\%1 -u %1\%2 -p %3 net start winvnc
ECHO.
ECHO %ZDATE% : %ZCLOCK% : %1 : VNC SERVICE WAS MANUALLY RESTARTED. > RESULTS.TMP
REN RESULTS.TXT OLDRESULTS.TMP > NUL
COPY OLDRESULTS.TMP + RESULTS.TMP RESULTS.TXT > NUL
DEL *.TMP > NUL
ECHO LOGGING RESULTS TO "%CURRENTPATH%\RESULTS.TXT"
ECHO.
ECHO DONE
GOTO END
:ERROR
cls
echo.
echo Usage: startvnc [remote NT box] [local admin user name] [local admin password]
echo.
:END
----- startvnc.bat END -----
And this machine.ini:
----- machine.ini START -----
\registry\machine\software\orl\winvnc3
AllowLoopback = REG_DWORD 0x00000000
Debug Level = REG_DWORD 0x00000000
Debug Mode = REG_DWORD 0x00000000
DisableTrayIcon = REG_DWORD 0x00000001
MSLogonRequired = REG_DWORD 0x00000001
UseDSMPlugin = REG_DWORD 0x00000000
\registry\machine\software\orl\winvnc3\default
AllowEditClients = REG_DWORD 0x00000000
AllowLoopback = REG_DWORD 0x00000000
AllowProperties = REG_DWORD 0x00000000
AllowShutdown = REG_DWORD 0x00000000
AutoPortSelect = REG_DWORD 0x00000001
BlankMonitorEnabled = REG_DWORD 0x00000001
DefaultScale = REG_DWORD 0x00000001
EnableDriver = REG_DWORD 0x00000001
EnableHook = REG_DWORD 0x00000001
EnableVirtual = REG_DWORD 0x00000000
FileTransferEnabled = REG_DWORD 0x00000001
HTTPConnect = REG_DWORD 0x00000000
IdleTimeout = REG_DWORD 0x00000000
InputsEnabled = REG_DWORD 0x00000001
LocalInputsDisabled = REG_DWORD 0x00000000
LockSetting = REG_DWORD 0x00000000
OnlyPollConsole = REG_DWORD 0x00000001
OnlyPollOnEvent = REG_DWORD 0x00000000
Password = REG_BINARY 0x00000008 0xe46754dc 0xf6fbfb3a
PollForeground = REG_DWORD 0x00000001
PollFullScreen = REG_DWORD 0x00000001
PollUnderCursor = REG_DWORD 0x00000000
QuerySetting = REG_DWORD 0x00000004
QueryTimeout = REG_DWORD 0x0000000F
RemoveWallpaper = REG_DWORD 0x00000001
SocketConnect = REG_DWORD 0x00000001
TurboMode = REG_DWORD 0x00000001
UseDSMPlugin = REG_DWORD 0x00000000
XDMCPConnect = REG_DWORD 0x00000000
\registry\machine\software\ultravnc\mslogon
group1 = REG_BINARY 0x0000000C 0x2D484F4D 0x504C4548 0x4B534544
locdom1 = REG_DWORD 0x00000002
\registry\users\.default\software\orl
VNCHooks
Application_Prefs
CALC.EXE
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000000
use_LButtonUp = REG_DWORD 0x00000000
use_Deferral = REG_DWORD 0x00000001
CLOCK.EXE
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000001
use_KeyPress = REG_DWORD 0x00000000
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000000
explorer.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000000
use_MButtonUp = REG_DWORD 0x00000001
use_RButtonUp = REG_DWORD 0x00000001
iexplore.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
mspaint.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
NOTEPAD.EXE
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
use_MButtonUp = REG_DWORD 0x00000001
use_RButtonUp = REG_DWORD 0x00000001
winlogon.exe
use_GetUpdateRect = REG_DWORD 0x00000001
use_Timer = REG_DWORD 0x00000000
use_KeyPress = REG_DWORD 0x00000001
use_LButtonUp = REG_DWORD 0x00000001
use_MButtonUp = REG_DWORD 0x00000001
use_RButtonUp = REG_DWORD 0x00000001
use_Deferral = REG_DWORD 0x00000001
----- machine.ini END -----
The mydetails.bat batch file:
----- mydetails.bat START -----
@echo off
cls
ver
echo.
echo User Name: %USERNAME%
echo.
echo Domain: %USERDOMAIN%
echo.
echo Computer Name: %COMPUTERNAME%
ipconfig
echo.
echo Press any key to exit the program.
PAUSE >NUL
----- mydetails.bat END -----
NOTE: for the mydetails.bat to work you will need to place it in the c:\fastpush\common folder and you will need to make a link to it and call the link 'My Details.lnk'. I suggest using one of those nice question mark icons in XP for this link... makes it look professional. It will place this link in the start menu for easy user access. For windows 9x you will need to change the ipconfig command to a 'winipcfg /batch temp.txt' command and then type the temp.txt file.
lol... well that was me... maybe I should register and this wont be a problem... looks like I'll have to change my default password since I just posted it on the internet
all the smileys that poped up in the script are pretty funny...
does anyone know if you ever get prompted for the default password when you have mslogon enabled?
.philodox.
all the smileys that poped up in the script are pretty funny...
does anyone know if you ever get prompted for the default password when you have mslogon enabled?
.philodox.
Did Not Work
This modification of the script does not work correctly, even with the smilieys corrected. Does anyone have a working version of Fastpush that will work with UltraVNC RC18 ?? Needed desperately.
- Rudi De Vos
- Admin & Developer
- Posts: 6863
- Joined: 2004-04-23 10:21
- Contact:
- Rudi De Vos
- Admin & Developer
- Posts: 6863
- Joined: 2004-04-23 10:21
- Contact:
fastpush to "XP Home" ?
Anybody already got fastpush working on "XP Home" ?