Table of Contents

UltraVNC Server

(By — yonis 2013/08/13 13:00) VNC-Server
2013-08-13

Script by MrNiceguy
Comments and improvements are welcome

Tested with opsi 4.0.2

UVNC Setup at http://www.uvnc.com/downloads/ultravnc.html

Tree:

setup.ins
start.ins
uninstall.ins
delsub.ins
killtask.ins (By  --- //[[tobias.friede@wki.fraunhofer.de|tobias]] 2012/10/01 20:07//)
Setup.exe
ultavnc.ini
ultravncInstall.inf
UltraVNC.png

setup.ins

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "UltraVNC"
Set $MinimumSpace$    = "5 MB"
; the path were we find the product after the installation
Set $InstallDir$      = "%ProgramFiles32Dir%\uvnc bvba\UltraVNC"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------
 
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
	if FileExists($InstallDir$ + "\winvnc.exe")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub32.ins"
	endif
 
	Message "Installing " + $ProductId$ + " ..."
 
	if $LicenseRequired$ = "true"
		comment "Licensing required, reserve license and get license key"
		Sub_get_licensekey
	endif
 
	comment "Start setup program"
	Winbatch_install
	Sub_check_exitcode
 
	comment "Copy files"
	Files_install /32Bit
 
	comment "Start application"
	Sub "%ScriptPath%\start.ins"
endif
 
[Winbatch_install]
; === Inno Setup ========================================================================================
; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
; You may create setup answer file by: setup.exe /SAVEINF="filename"
; You may use an answer file by the parameter /LOADINF="filename"
 "%ScriptPath%\Setup.exe" /verysilent /LOADINF="%ScriptPath%\ultravncInstall.inf" /log /norestart
 
[Files_install]
; Example of recursively copying some files into the installation directory:
;
 copy -s "%ScriptPath%\ultravnc.ini" "$InstallDir$"
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

start.ins

[Actions]
setloglevel = 6
requiredWinstVersion >= "4.11.2.9"
 
DefVar $InstallDir$
 
Set $InstallDir$ = "%ProgramFiles32Dir%\uvnc bvba\UltraVNC\winvnc.exe"
 
 
;if FileExist("%ProgramFiles32Dir%\uvnc bvba\UltraVNC\winvnc.exe")
	comment "Start Application"
	DosBatch_1
;endif
 
 
[DosBatch_1]
	"%ProgramFiles32Dir%\uvnc bvba\UltraVNC\winvnc.exe"

uninstall.ins

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "opsi-template"
Set $InstallDir$      = "%ProgramFiles32Dir%\uvnc bvba\UltraVNC"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------
 
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\killtask.ins")
	comment "Sart task kill sub section"
	Sub "%ScriptPath%\killtask.ins"
endif
 
if FileExists("%ScriptPath%\delsub32.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub32.ins"
endif
 
if $LicenseRequired$ = "true"
	comment "Licensing required, free license used"
	Sub_free_license
endif

delsub.ins

Set $UninstallProgram$ = $InstallDir$ + "\unins000.exe"
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists($UninstallProgram$)
;	comment "Uninstall program found, starting uninstall"
	Winbatch_uninstall
	sub_check_exitcode
endif
 
;comment "Uninstall"
winbatch_uninstall
 
comment "Delete files"
Files_uninstall /32Bit
 
[Winbatch_uninstall]
 
  Sub "%SciptPath%\killtask.ins"
  "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES
 
[Files_uninstall]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
 delete -sf "$InstallDir$\"
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

killtask.ins

(By — tobias 2012/10/01 20:07)

[Actions]
setloglevel = 6
requiredWinstVersion >= "4.11.2.9"
 
DefVar $process2$
DefVar $subvar$
DefVar $killtask$
 
DefStringList $processlist$
DefStringList $process$
DefStringList $SearchProcess$
 
;----------Definiere hier welche Programme gesucht und geschlossen werden sollen--------------------------------
set $searchProcess$ = createStringList ('winvnc.exe')
;sollen die Programme automatisch geschlossen werden? ACHTUNG: Datenverlust möglich!
set $killtask$ = "true"
;----------------------------------------------------------------------------------------------------------------
 
for %s% in $SearchProcess$ do sub_checkfunktion
 
[sub_checkfunktion]
set $subvar$ = "%s%"
set $processlist$ = getOutStreamFromSection('DosInAnIcon_checkprocess')
set $process$ = splitString(takeString(1,$processlist$), ",")
set $process2$ = unquote(takeString(1,$processlist$), '"')
 
DosBatch_1
 
if ($process2$ = $subvar$)
Message = "Prozess gefunden"
	if ($killtask$ = "true")
		killtask $subvar$	
	else
		message "killtask is set false"
	endif
else
message = "Prozess nicht gefunden"
endif
 
 
 
[DosInAnIcon_checkprocess]
@echo off
TASKLIST /FI "IMAGENAME eq $subvar$" /fo CSV
 
[DosBatch_1]
	net stop uvnc_service
	sc delete uvnc_service

ultravnc.ini

[ultravnc] 		
passwd=2160ACF6951DC37C14
passwd2=6391200523C3E93A22
[admin] 		
FileTransferEnabled=1
FTUserImpersonation=1
BlankMonitorEnabled=1 		
BlankInputsOnly=0 		
CaptureAlphaBlending=1 		
BlackAlphaBlending=0 		
DefaultScale=1
UseDSMPlugin=0
DSMPlugin=Pfad zum DSM Plugin
DSMPluginConfig=Konfiguration DSM Plugin
primary=1 		
secondary=0 		
SocketConnect=1 		
HTTPConnect=1
XDMCPConnect=0 		
AutoPortSelect=1
InputsEnabled=1 		
LocalInputsDisabled=0
IdleTimeout=0
EnableJapInput=0 		
QuerySetting=2 		
QueryTimeout=10 		
QueryAccept=0 		
LockSetting=0 		
RemoveWallpaper=1
RemoveEffects=0
RemoveFontSmoothing=0 		
RemoveAero=1
DebugMode=2
Avilog=0 		
path=C:\Programme\uvnc bvba\UltraVnc\log                             		Pfad zu Ultra VNC
DebugLevel=10 		
AllowLoopback=0 		
LoopbackOnly=0 		
AllowShutdown=0 		
AllowProperties=1 		
AllowEditClients=1 		
FileTransferTimeout=30
KeepAliveInterval=5 		
SocketKeepAliveTimeout=10000 		
DisableTrayIcon=0 		
MSLogonRequired=0
NewMSLogon=0 		
ConnectPriority=0 		
UseRegistry=0 		
AuthRequired=1 		
AuthHosts= 		
PortNumber=5900 		
HTTPPortNumber=5800 		Port Nummer für Verbindung über Java
QueryIfNoLogon=1 		
kickrdp=0 		
clearconsole=0 		
[admin_auth] 		Administratorgruppen für Authentifizierung
group1=DOMAIN\Administratoren
group2=
group3= 		
locdom1=0
locdom2=0
locdom3=0 		
[poll] 		
TurboMode=1 		
PollUnderCursor=0 		
PollForeground=0 		
PollFullScreen=1 		
OnlyPollConsole=0 		
OnlyPollOnEvent=0 		
MaxCpu=40 		
EnableDriver=0 		
EnableHook=1 		
EnableVirtual=0 		
SingleWindow=0 		
SingleWindowName=
[Permissions]

ultravncinstall.inf

[Setup]
Lang=de
Dir=C:\Program Files\uvnc bvba\UltraVNC
Group=UltraVNC
NoIcons=0
SetupType=server_silent
Components=ultravnc_server
Tasks=installservice,startservice