Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: 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://twitter.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Documentation for Silent / Unattended Setup

Post Reply
SkyBeam
80
80
Posts: 142
Joined: 2012-12-31 11:01

Re: Documentation for Silent / Unattended Setup

Post by SkyBeam »

QandA wrote:Could you please provide a documentation of how to silently
It's actually a standard innosetup installer and support its silent options.
You can run the installation on a "master" compute using

Code: Select all

<exeInstaller> /saveinf="C:\temp\uvnc-unattended.inf"
Then just install as normal, doing all required selections on the installation GUI. After installation you will find your inf file (e.g. c:\temp\uvnc-unattended.inf") in the location you set above.

Now you can run the installer silently on additional computes, eg. from a cmd script or shortcut:

Code: Select all

<exeInstaller> /verysilent /norestart /sp- /loadinf="C:\temp\uvnc-unattended.inf"
Well, you need to adjust the paths perhaps, but you got the idea I guess.

Alternatively you can of course use the MSI installer (note, the MSI installer will be provided later for the latest 1.2.3.x release, it's not yet available). With MSI you can use the default silent options.

Code: Select all

msiexec /i <msi-path.msi> /qn /norestart
Note: If you want to customize the installation (path, modules etc.) in MSI installer, then use Orca or SuperOrca to build a template file and add the TRANSFORMS="Path\to\transforms.mst" argument to msiexec to apply your modifications to the MSI tables.

Uninstalling MSI is equally easy

Code: Select all

msiexec /x <msi-path.msi> /qn /norestart

If you use the EXE installer you need to actually run the uninstaller from the installation folder silently:

Code: Select all

unins000.exe /verysilent /norestart /sp-
Unfortunately depending on your amounts of re-installs you might actually also have unins001.exe, unins002.exe etc. The unisnstallers are only valid if there is a corresponding uninsXXX.msg file available.
Moreover it's recommended to attempt killing the processes before you try to uninstall. Also try to kill winvnc.exe and uvnckeyboardhelper.exe (Windows 8 only?). Also depending on the OS and screen capturing method your schook.dll/schook64.dll might be locked which will make the uninstall fail. But you can use taskkill to kill all processes which use schook.dll/schook64.dll (actually very often it's injected into explorer.exe).

Well, I did write a script to uninstall UltraVNC pretty reliably, tested with 64-bit version, but should work with 32-bit version too.

Code: Select all

@echo off
:: This ia a very simple uninstaller script which was written to just run an
:: existing uninstaller in silent mode.

:: Source settings.
call "%~dp0var.cmd"

:: Service name
set SERVICE_NAME=uvnc_service

:: Location where VNC is installed
:: set APP_DIR=uvnc bvba\UltraVNC
set APP_DIR=UltraVNC
set INSTALL_TARGET=%ProgramFiles(x86)%\%APP_DIR%
if exist "%ProgramFiles%\%APP_DIR%" set INSTALL_TARGET=%ProgramFiles%\%APP_DIR%

:: Tools.
set TOOLS_TASKKILL=%~dp0taskkill.exe
if exist "%SystemRoot%\system32\taskkill".exe set TOOLS_TASKKILL=%SystemRoot%\system32\taskkill.exe

:: Path where the uninstaller is located
:: set APP_DIR=%APP_DIR%

:: Options to be passed to the uninstaller in order to uninstall silently
set OPTIONS=/verysilent /norestart /sp-

:: Define exit code.
set EXIT_CODE=0

:: Shut down service.
:: echo Stopping service.
:: sc stop "%SERVICE_NAME%" > NUL 2>&1

echo Stopping existing service
net stop "%SERVICE_NAME%" > NUL 2>&1
:: sc stop "%SERVICE_NAME%" > NUL
:: Force stop service.
:: "%~dp0taskkill.exe" /FI "SERVICES eq %SERVICE_NAME%" /F
"%TOOLS_TASKKILL%" /FI "SERVICES eq %SERVICE_NAME%" /F >NUL 2>&1
"%TOOLS_TASKKILL%" /IM "winvnc.exe" /F >NUL 2>&1
"%TOOLS_TASKKILL%" /IM "uvnckeyboardhelper.exe" /F >NUL 2>&1

:: Files which might be listed in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations and therefore blocking a re-install.
del /f /q "%INSTALL_TARGET%\schook.dll" > NUL 2>&1
del /f /q "%INSTALL_TARGET%\schook64.dll" > NUL 2>&1
del /f /q "%INSTALL_TARGET%\winvnc.exe" > NUL 2>&1
del /f /q "%INSTALL_TARGET%\is-*.exe" > NUL 2>&1
if exist "%INSTALL_TARGET%\schook.dll" "%TOOLS_TASKKILL%" /FI "MODULES eq schook.dll" /F >NUL 2>&1
if exist "%INSTALL_TARGET%\schook64.dll" "%TOOLS_TASKKILL%" /FI "MODULES eq schook64.dll" /F >NUL 2>&1

:: Uninstall legacy path
if "%APP_DIR%" == "UltraVNC" goto skipDefaultUVNC
call :uninstall "UltraVNC"
:skipDefaultUVNC

call :uninstall "%APP_DIR%"

:: ############################################################################
:: No need to change anything below this line (usually ;-))
:: ############################################################################
:uninstall
setlocal
:: Fetch application directory.
set APP_INSTALL_DIR=%~1

echo Removing Application
setlocal enabledelayedexpansion
set EXIT_CODE=0

if not exist "%ProgramFiles(x86)%\%APP_INSTALL_DIR%" goto skip32bit
for /f %%I IN ('dir /O:-N /b "%ProgramFiles(x86)%\%APP_INSTALL_DIR%\unins*.exe"') DO (
  if exist "%ProgramFiles(x86)%\%APP_INSTALL_DIR%\%%~nI.msg" (
    :: echo Uninstalling "%ProgramFiles(x86)%\%APP_INSTALL_DIR%\%%I"
    start /wait "Uninstall" "%ProgramFiles(x86)%\%APP_INSTALL_DIR%\%%I" %OPTIONS%
    if !ERRORLEVEL! GTR !EXIT_CODE! set EXIT_CODE=!ERRORLEVEL!
  )
)
:skip32bit

if not exist "%ProgramFiles%\%APP_INSTALL_DIR%" goto skip64bit
for /f %%I IN ('dir /O:-N /b "%ProgramFiles%\%APP_INSTALL_DIR%\unins*.exe"') DO (
  if exist "%ProgramFiles%\%APP_INSTALL_DIR%\%%~nI.msg" (
    :: echo Uninstalling "%ProgramFiles%\%APP_INSTALL_DIR%\%%I"
    start /wait "Uninstall" "%ProgramFiles%\%APP_INSTALL_DIR%\%%I" %OPTIONS%
    if !ERRORLEVEL! GTR !EXIT_CODE! set EXIT_CODE=!ERRORLEVEL!
  )
)
:skip64bit
endlocal
exit /B %EXIT_CODE%


:end
:: pause
exit /b 0
Post Reply