@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! * :: **************************************************************************************************** set fpver=8.0 set oldpath=%path% set nowpath= for /f "tokens=*" %%g in ('cd') do @set nowpath=%%g :: *** CHECK THAT THE COMPUTER RUNNING THIS SCRIPT IS NT - AS IT DOESN'T WORK ON 9x *** if not "%OS%"=="Windows_NT" GOTO NOTNT :: *** SET THE VARIABLES TO BLANK OR DEFAULT SETTINGS *** :: tweakable variables (see the manual) :: *** what flavour should fastpush default to (vnc, vnc9, tridia13, tridia14, etc) *** set flav=real411 :: *** do or do not install the viewer by default *** set viewer=yes :: *** do or do not log all installs *** set logit=no :: *** using fastpush from a specified location - you can call it from the path that way. *** :: *** do not use quote marks as this breaks IF statements. Long pathnames are okay *** :: *** leave blank for just use the current location *** set fplocation=c:\fastpush :: *** If you always want start menu VNC shortcuts installing, say yes. If not, put no *** :: *** You will need Windows Scripting Host to make use of this VBS creation routine *** set shortcut=yes :: *** Copy a script to the user's machine that reports computer name, IP, etc *** :: *** Turning shortcut=yes off will stop a link being made to the user's desktop *** set macrep=yes :: *** Should the VNC service start automatically or be manual? *** :: *** yes = automatic and no = manual *** set service=yes :: *** Set cmdcheck to yes to check for the reskit tool, set to no if no check wanted *** :: *** Scan variable includes the file names of each util to check for *** :: *** You also have to set cmdarray equal to the number of ojbects you want to check on *** set psexec=no :: *** set this to no to use XCMD and set it to yes to use PSEXEC *** :: *** Xcmd is freeware and can be bundled in the fastpush zip file whereas PSEXEC must *** :: *** be downloaded from Sysinternals. XCMD works on most computers but not all *** set wait=no :: *** set wait to yes if you want to have PAUSE statements activated *** :: *** by default. Otherwise, use /wait to turn them on as required. *** set cmdcheck=yes set cmdarray=8 set scan=XCMD REG REGDIR REGINI RMTSHARE SC SHORTCUT TIMEOUT :: fixed variables 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 ping=yes set oprogfiles= set real4=no :: *** CHECK THAT fplocation is VALID *** if "%fplocation%"=="" goto :cmdoptions :: check for spaces in the fplocation variable for /f "tokens=* delims= " %%p in ('echo %fplocation%^|find /i /c " "') do @set pv=%%p if "%pv%"=="1" ( echo. echo Script is version %fpver% echo. echo The FPLOCATION variable contained spaces. Please change this to echo a short pathname. Fastpush does not support long path names. echo. echo You specified FPLOCATION as %fplocation% goto :end ) if not exist "%fplocation%\*.*" ( echo. echo Script is version %fpver% echo. echo The FPLOCATION variable was set to a path that could echo not be found on this machine. Please check it. echo. echo The path you specified was %fplocation% goto :end ) :cmdoptions :: *** READ THE COMMAND LINE SWITCHES *** if "%1" == "" goto help :: *** 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=/flavour 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 flavourhelp 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 set test=/wait 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 wait=yes :: *** FIND WHAT VERSION OF VNC PPL WANT TO INSTALL *** set test=/real411 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" echo VNC command switch of %test% will be used.&set flav=%test:~1,255%&goto fchoice set test=/real4 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" echo VNC command switch of %test% will be used.&set flav=%test:~1,255%&goto fchoice set test=/ultra 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" echo VNC command switch of %test% will be used. & set flav=%test:~1,255%&goto fchoice set test=/real337 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" echo VNC command switch of %test% will be used. & set flav=%test:~1,255%&goto fchoice set test=/zvnc 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" echo VNC command switch of %test% will be used. & set flav=%test:~1,255%&goto fchoice set test=/tight129 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" echo VNC command switch of %test% will be used. & set flav=%test:~1,255%&goto fchoice :fchoice if "%flav%"=="" Echo No valid command line was chosen.& set logvalue=nocmd& goto end if "%flav%"=="real4" set real4=yes if "%flav%"=="real411" set real4=yes if not "%remove%"=="yes" Echo The final choice will be %flav%. 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 Fastpush Installer script %fpver% (c) 2002, Richard Harris echo *----------------------------------------------------------------------------* Echo * fp (remote NT box) (blank, /vnc or /tridia) (/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 * To list supported WinVNC variations use /flavour * echo * For examples try vnc /examples http://www.darkage.co.uk/ * Echo \****************************************************************************/ goto END :flavourhelp Echo /****************************************************************************\ echo VNC Fastpush Installer script %fpver% (c) 2002, Richard Harris echo *----------------------------------------------------------------------------* Echo * fp (remote NT box) (blank, /vnc or /tridia) (/test) (/user user password) * echo *----------------------------------------------------------------------------* echo * /real411 = RealVNC Version 4.11 * echo * /real4 = RealVNC Version 4 * echo * /real337 = RealVNC Version 3.3.7 * echo * * echo * /tight129 = Install TightVNC version 1.29 * echo * * echo * /zvnc = Install zVNC (zebedee comp/encryption) * echo * /ultra = Install UltraVNC (NTLM and file transfer * echo * * echo * You can set the default VNC choice using the "flav" variable (see script) * echo * For examples try vnc /examples http://www.darkage.co.uk/ * Echo \****************************************************************************/ goto end :examples cls Echo /****************************************************************************\ echo VNC Fastpush Installer script %fpver% - (c) 2002, Richard Harris echo * vnc server2 /tridia152 /noview = install tridia 1.52 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% if "%use%"=="yes" echo Use this password : %pass% 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' desktop icon : %macrep% if "%passflag%"=="yes" echo Use specified VNC password : yes if "%passflag%"=="no" echo Use specified VNC password : no echo --------------------------------------------------------------- echo. if "%wait%"=="yes" pause :: *** 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 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%\*.cmd" ( Echo. echo R1 - VNC found and updating path set fplocation=%currentpath% path="%currentpath%\utils";%path% goto cfgcheck ) if NOT "%fplocation%"=="" if exist "%fplocation%\*.cmd" ( Echo R2 - VNC found in %fplocation% set currentpath=%fplocation% goto cfgcheck ) if "%fplocation%"=="" if NOT exist "%currentpath%\*.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 ) echo. echo *** PATH ERROR *** echo. echo No CMD files could be found in the fplocation path. echo Please check your configuration. goto end :cfgcheck echo Changing current directory to %fplocation%\utils cd /d %fplocation%\utils 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 :: *** 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 if not "%missing%"=="yes" echo All utilities present. Please wait. 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. :: *** CHECK THAT THE VNC FOLDER IS AVAILABLE *** echo. echo Checking to see if the source VNC files can be found in "%currentpath%\%flav%" if not exist "%currentpath%\%flav%\*.*" ( echo. echo ******************************************************************** Echo * ERROR! Fastpush could not find the source VNC files. Please * echo * check the source folder exists within the fastpush folder * echo ******************************************************************** goto :end ) :: if exist "%currentpath%\%flav%\*.*" echo Path found. Next step.... :: echo. :: *** CHECK THAT THE FILES ARE AVAILABLE ***@@ if "%real4%"=="yes" goto :real4check if "%real4%"=="no" goto :real3check :real4check if not exist "%currentpath%\%flav%\logmessages.dll" echo ** WARNING! **&echo logmessage.dll missing from %currentpath%\%flav%&set missing=yes if not exist "%currentpath%\%flav%\vncviewer.exe" echo ** WARNING! **&echo vncviewer.exe missing from %currentpath%\%flav%&set missing=yes if not exist "%currentpath%\%flav%\winvnc4.exe" echo ** WARNING! **&echo winvnc4.exe missing from %currentpath%\%flav%&set missing=yes if not exist "%currentpath%\%flav%\vncconfig.exe" echo ** WARNING! **&echo vncconfig.exe missing from %currentpath%\%flav%&set missing=yes if not exist "%currentpath%\%flav%\wm_hooks.dll" echo ** WARNING! **&echo wm_hooks.dll missing from %currentpath%\%flav%&set missing=yes goto :checkresults :real3check if not exist "%currentpath%\%flav%\vnchooks.dll" echo ** WARNING! **&echo vnchooks.dll missing from %currentpath%\%flav%&set missing=yes if not exist "%currentpath%\%flav%\winvnc.exe" echo ** WARNING! **&echo winvnc.exe missing from %currentpath%\%flav%&set missing=yes goto :checkresults :checkresults if "%missing%"=="yes" ( echo. echo Not all of the files necessary for a VNC install where found echo Please check the source folder contents. echo. goto :end ) if NOT "%missing%"=="yes" echo All required VNC files are present in %currentpath%\%flav% :: *** 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 *** USING PING TO FIND TARGET STATUS *** echo. Echo Please wait while a TCP/IP connection to %targetpc% is made. if "%wait%"=="yes" pause 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 echo. echo *** LOGGING ON TO THE TARGET PC *** 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% if "%wait%"=="yes" pause :: *** 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 *** echo. 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 if errorlevel 0 echo Remote system drive found okay [%remotetarget%]. FOR /F "tokens=1* delims=:\" %%C IN ('REG QUERY "\\%targetpc%\HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v SystemRoot') DO SET folder=%%D if errorlevel 0 echo Windows location found okay [%folder%]. FOR /F "tokens=2 delims=:\" %%G IN ('REG QUERY "\\%targetpc%\HKLM\software\Microsoft\Windows\CurrentVersion" /v ProgramFilesDir') DO SET oprogfiles=%%G if errorlevel 0 echo Program files location found okay [%oprogfiles%]. echo. echo *** CHECK REMOTE PROGRAM FILES FOLDER *** echo. if exist "\\%targetpc%\%remotetarget%$\%oprogfiles%\*.*" echo Access to the remote Program Files location confirmed if not exist "\\%targetpc%\%remotetarget%$\%oprogfiles%\*.*" ( echo. echo *** WARNING! *** echo Access could to the remote Program Files location could not be confirmed. echo Please check that the folder below exists: echo. echo "\\%targetpc%\%remotetarget%$\%oprogfiles%" echo. goto :end ) :: set progfiles for VNC3 versions set progfiles=%oprogfiles%\Orl\VNC :: set progfile for VNC4 versions If "%real4%"=="yes" set progfiles=%oprogfiles%\RealVNC\VNC4 echo. echo *** CHECKING START MENU *** echo. Echo Querying remote PC %targetpc% registry 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 if errorlevel 0 echo The Start Menu Common Programs variable has been read from the registry. set startpath=\\%targetpc%\%remotetarget%$\%commonprogs% if not exist "\\%targetpc%\%remotetarget%$\%commonprogs%\*.*" ( echo. echo *** WARNING! *** echo. echo The Start Menu variable has been read from the remote registry echo but could not be found on the remote compueter. echo This problem may have been caused by a fault with REG.EXE and echo non-English Windows installations goto :end ) if exist "\\%targetpc%\%remotetarget%$\%commonprogs%\*.*" echo The Start Menu folders have been accessed successfullyremotely. :: 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. echo *** QUERYING AND CONFIGURING ANY EXISTING VNC SERVICE *** 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 Attempting to stop the VNC service on %targetpc% sc \\%targetpc% STOP winvnc >nul 2>nul sc \\%targetpc% STOP winvnc4 >nul 2>nul if exist "%fplocation%\utils\timeout.exe" "%fplocation%\utils\timeout" 5 :deleteservice Echo Deleting the WinVNC service on %targetpc% sc \\%targetpc% DELETE winvnc >nul 2>nul sc \\%targetpc% DELETE winvnc4 >nul 2>nul Echo Deleting previous VNC registry keys from %targetpc%. reg delete \\%targetpc%\HKLM\software\orl\winvnc3 /f > nul 2>nul reg delete \\%targetpc%\HKU\.Default\Software\Orl /f > nul 2>nul reg delete \\%targetpc%\HKLM\software\microsoft\windows\currentversion\run /v WinVNC /f > nul 2>nul reg delete \\%targetpc%\HKLM\software\realvnc\WinVNC4 /f >nul 2>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 *** COPYING FILES *** echo. Echo Target = %targetPC% echo Source = %currentpath%\%flav% echo Destination = %targetpath% echo. if "%wait%"=="yes" pause :: *** Use the flavour variable to pick the right source folder for VNC *** if not exist %targetpath% md %targetpath% set copycmd=/y if exist "%targetpath%\vnchooks.dll" rename "%targetpath%\vnchooks.dll" vnchooks.old if exist "%targetpath%\vnchooks.old" del "%targetpath%\vnchooks.old" if "%real4%"=="yes" ( xcopy "%currentpath%\%flav%\*.dll" %targetpath% /r /v xcopy "%currentpath%\%flav%\*.exe" %targetpath% /r /v ) if NOT "%real4%"=="yes" ( xcopy "%currentpath%\%flav%\v*.dll" %targetpath% /r /v xcopy "%currentpath%\%flav%\w*.*" %targetpath% /r /v if exist "%currentpath%\%flav%\oth*.dll" xcopy "%currentpath%\%flav%\oth*.dll" %targetpath% /r /v if exist "%currentpath%\%flav%\om*.dll" xcopy "%currentpath%\%flav%\om*.dll" "\\%targetpc%\%remotetarget%$\%folder%\system32" /r /v ) :: AD authenticated DLLs for UltraVNC if exist "%currentpath%\%flav%\au*.dll" xcopy "%currentpath%\%flav%\au*.dll" %targetpath% /r /v if "%macrep%"=="yes" xcopy "%currentpath%\common\MyDetails.exe" "\\%targetpc%\%remotetarget%$\%folder%\system32" /r /v if exist "%currentpath%\%flav%\z*.dll" xcopy "%currentpath%\%flav%\z*.dll" %targetpath% /r /v if "%viewer%"=="yes" xcopy "%currentpath%\%flav%\vncvi*.exe" %targetpath% /r /v :: *** CHECK THAT THE FILES HAVE BEEN UPLOADED *** echo. echo *** CONFIRM THAT THE THE NECESSRY FILES HAVE BEEN UPLOADED *** echo. set missing=no if "%real4%"=="yes" goto :real4copy if "%real4%"=="no" goto :real3copy :real4copy if not exist %targetpath%\logmessages.dll echo ** WARNING! **&echo logmessage.dll missing from %targetpath%&set missing=yes if not exist %targetpath%\winvnc4.exe echo ** WARNING! **&echo winvnc4.exe missing from %targetpath%&set missing=yes if not exist %targetpath%\vncconfig.exe echo ** WARNING! **&echo vncconfig.exe missing from %targetpath%&set missing=yes if not exist %targetpath%\wm_hooks.dll echo ** WARNING! **&echo wm_hooks.dll missing from %targetpath%&set missing=yes goto :copycheck :real3copy if not exist %targetpath%\vnchooks.dll echo ** WARNING! **&echo vnchooks.dll missing from %targetpath%&set missing=yes if not exist %targetpath%\winvnc.exe echo ** WARNING! **&echo winvnc.exe missing from %targetpath%&set missing=yes goto :copycheck :copycheck if "%missing%"=="no" echo All files necessary for the VNC service have been successfully installed. if "%missing%"=="yes" ( echo. echo Files critical to the operation of VNC were not uploaded the remote computer. echo Please check that the source files are available in the Fastpush home folder. echo You should also check the security rights to the folder you are attempting to copy to. goto :end ) 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 ******************************************************************************* timeout 10 echo. Echo Cross your fingers! :-) Echo. 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%" timeout 10 goto newpass :frompath echo Using : regini -m \\%targetpc% "%currentpath%\%configfile%" regini -m \\%targetpc% "%currentpath%\%configfile%" timeout 10 goto newpass :: *** INSTALL THE DEFAULT VNC SETTINGS *** :defaultvnc echo. echo *** CONFIGURING REGISTRY SETTINGS *** echo. Echo Installing the default settings for VNC into the remote registry. Please wait. if "%real4%"=="yes" ( Echo regini -m \\%targetpc% "%currentpath%\common\vnc4.ini" regini -m \\%targetpc% "%currentpath%\common\vnc4.ini" > nul if errorlevel 0 echo Registry files successfullyapplied. ) if NOT "%real4%"=="yes" ( Echo regini -m \\%targetpc% "%currentpath%\common\machine.ini" regini -m \\%targetpc% "%currentpath%\common\machine.ini" > nul if errorlevel 0 echo Registry files successfully applied. ) :: *** Check what flavour of VNC and install any REG tweaks if required *** if "%flav%"=="vnc9" regini -m \\%targetpc% "%currentpath%\common\vnc9nopaper.ini" if "%warning%"=="yes" regini -m \\%targetpc% "%currentpath%\common\warning.ini" :: *** 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. if "%real4%"=="yes" goto installvnc4 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 if exist "\\%targetpc%\%remotetarget%$\%oprogfiles%\realVNC\vnc4\*.*" ( echo Deleting VNC4 from %oprogfiles%\realVNC\Vnc4 rd "\\%targetpc%\%remotetarget%$\%oprogfiles%\realVNC" /s /q ) :: *** 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 :servfail echo. echo *** WARNING! *** echo The VNC service could not be started. echo This may be due to a missing file or bad registry settings. Please investigate. goto :end :installvnc4 Echo Installing WinVNC to %remotetarget%:\%progfiles% if exist "\\%targetpc%\%remotetarget%$\%oprogfiles%\orl\vnc\*.*" ( Echo Deleting old VNC installation. rd "\\%targetpc%\%remotetarget%$\%oprogfiles%\orl" /s /q ) :: set if you want the service to be a manual start - change auto to manual echo. echo *** SERVICE CONFIGURATION *** echo. if "%service%"=="yes" ( SC \\%targetpc% create WinVNC4 binpath= "%remotetarget%:\%progfiles%\WinVNC4.exe -service" type= own type= interact start= auto SC \\%targetpc% start winvnc4 if not errorlevel 0 goto :servfail goto makeshorts ) if "%service%"=="no" SC \\%targetpc% create WinVNC4 binpath= "%remotetarget%:\%progfiles%\WinVNC4.exe -service" type= own type= interact start= demand :startserver :: *** FIRE UP THE SERVICE *** Echo Attempting to start the service..... if "%service%"=="yes" sc \\%targetpc% start winvnc if not errorlevel 0 goto :servfail 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. echo *** CONFIGURING START MENU SHORTCUTS *** echo. if "%shortcut%"=="no" echo Skipped Start Menu Shortcut Creation & goto sucess if "%wait%"=="yes" pause Echo Script will 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 NOT "%real4%"=="yes" ( 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 "%real4%"=="yes" ( if exist "%startpath%\VNC\*.*" rd "%startpath%\VNC" /s /q if not exist "%startpath%\RealVNC" mkdir "%startpath%\RealVNC" if not exist "%startpath%\RealVNC\VNC Server 4 (Service-Mode)" mkdir "%startpath%\RealVNC\VNC Server 4 (Service-Mode)" if not exist "%startpath%\RealVNC\VNC Server 4 (User-Mode)" mkdir "%startpath%\RealVNC\VNC Server 4 (User-Mode)" if not exist "%startpath%\RealVNC\VNC Viewer 4" mkdir "%startpath%\RealVNC\VNC Viewer 4" echo shortcut -f -t "%remotetarget%:\%progfiles%\vncconfig.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (Service-Mode)\Configure VNC Service" -d "%remotetarget%:\%progfiles%" -a "-service">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\winvnc4.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (Service-Mode)\Register VNC Service" -d "%remotetarget%:\%progfiles%" -a "-register">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\winvnc4.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (Service-Mode)\Start VNC Service" -d "%remotetarget%:\%progfiles%" -a "-start">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\winvnc4.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (Service-Mode)\Stop VNC Service" -d "%remotetarget%:\%progfiles%" -a "-stop">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\winvnc4.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (Service-Mode)\Unregister VNC Service" -d "%remotetarget%:\%progfiles%" -a "-unregister">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\vncconfig.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (User-Mode)\Configure User-Mode Settings" -d "%remotetarget%:\%progfiles%" -a "-user">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\winvnc4.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Server 4 (User-Mode)\Run VNC Server" -d "%remotetarget%:\%progfiles%" -a "-noconsole">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\vncviewer.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Viewer 4\Run Listening VNC Viewer" -d "%remotetarget%:\%progfiles%" -a "-listen">>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" echo shortcut -f -t "%remotetarget%:\%progfiles%\vncviewer.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\VNC Viewer 4\Run VNC Viewer" -d "%remotetarget%:\%progfiles%" -a "">>"\\%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" if "%real4%"=="yes" echo shortcut -f -t "%remotetarget%:\%folder%\system32\mydetails.exe" -n "%remotetarget%:\%commonprogs%\RealVNC\My Details" >>"\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" if not "%real4%"=="yes" 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. echo *** EXECUTING START MENU ICONS SCRIPT ON TARGET PC *** echo. if "%psexec%"=="yes" psexec \\%targetpc% "%remotetarget%:\%folder%\icons.cmd" if NOT "%psexec%"=="yes" xcmd \\%targetpc% "%remotetarget%:\%folder%\icons.cmd" /nowait goto rem%errorlevel% :rem0 Echo. Echo Icons command excuted on remote machine %targetpc% if "%wait%"=="yes" pause echo del "\\%targetpc%\%remotetarget%$\%folder%\icons.cmd" /q goto sucess :rem1 Echo. ECHO *** WARNING! *** Echo Icons command failed!! Investigate %targetpc%. if "%wait%"=="yes" pause goto sucess :rem-1 Echo. ECHO *** WARNING! *** Echo Icons command failed!! Investigate %targetpc%. if "%wait%"=="yes" pause goto sucess :rem128 Echo. ECHO *** WARNING! *** Echo Xcmd service unable to be installed. Investigate %targetpc%. Echo Shortcuts were not created / updated. if "%wait%"=="yes" pause goto sucess :rem-1073741510 echo. echo *** WARNING! *** echo Xcmd service failed to create the icons. echo Please investigate %targetpc%. Echo Shortcuts were not created or updated. if "%wait%"=="yes" pause goto sucess echo End of shortcut creation scheme goto sucess :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 will be deleted from %targetpath% echo and the registry entries will also be deleted. echo This script will not remove any shortcuts though. echo. timeout 15 echo Files and host directory will be deleted from %targetpath% echo. Echo Start menu shortcuts will be removed from : echo "%startpath%". if exist "%startpath%\vnc" rd "%startpath%\vnc" /q /s | Echo Deleted existing VNC shortcuts. if exist %targetpath% rd %targetpath% /q /s | Echo %targetpath% folder removed. if "%real4%"=="yes" if exist %otargetpath%\orl\vnc rd %otargetpath%\orl\vnc /q /s | Echo %targetpath% folder removed. if exist "\\%targetpc%\%remotetarget%$\%folder%\system32\omnithread*.dll" del "\\%targetpc%\%remotetarget%$\%folder%\system32\omnithread*.dll" /s 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 :SUCESS 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 : ********** 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. 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 blah blah 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 OF THE LINE *** :END set user= set pass= set vncpass= if "%pushd%"=="1" POPD if exist "%fplocation%\%targetpc%pass.ini" del "%fplocation%\%targetpc%pass.ini" set path=%oldpath% cd /d %nowpath%