ThinPrint Client 8.0 MSI-Package

this script deployed the .print Client engine for Citrix. You must defined a product dependency to the Citrix Plugin for hosted solutions and 2 properties with name UDPPort and TCPPort. So you can define the ports for the firewall. The default value are for this program is 4000 for both ports ( program standard)

Dieses Script verteilt die .print Client Komponente von ThinPrint. In der Produktdefinition müssen Sie eine Produktabhängigkeit zu den Ctrix Plugin für gehostete Anwendungen erstellen und 2 Produkteigenschften mit dem Namen UDPPort und TCPPort. Damit haben Sie die Möglichkeit, die Firewall-Ports vorzudefinieren. Als Standardeinstellung ist 4000 für beide Ports (Prorgamm-Standard)

tested under Windows 7/32 Bit / Getestet unter Windows 7 32 Bit

the 64 Bit section is under construction / Die 64 Bit Sektion ist noch in Arbeit

questions to / Fragen an Frisoft

loading the licensed components / Herunterlader der zu lizensierenden Konponenten http://www.thinprint.de/Download/ClientsTools.aspx

the product picture are downloaded from Internet / Das Produktbild ist aus dem Internet herunterzuladen

the scripts are unversal scripts, they are customized for many sloutions / Die Scripts sind Unversal-Scripts, die schon für einige Lösungen abgepasst wurden

the scripts are based of a Solution from forum member Thomas_H / Die Scripte basieren auf einer Lösung vom Forum - Mitglied Thomas_H

the next steps / die nächsten Schritte

my directory strcture / Meine Verzeichnisstruktur

 files\TPTCP_x64_deu\ThinPrint\TPTCP_x64_deu.msi
 files\TPTCP_x86_deu\ThinPrint\TPTCP_x86_deu.msi
 delsub.ins
 setup.ins
 uninstall.ins
 ThinPrint.jpg

setup.ins

[Initial]
setLogLevel=9
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $OS$
DefVar $NTVersion$
DefVar $MSOS$
DefVar $Systemtype$
 
DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
Defvar $InstallTmpDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
defvar $INSTVersion$
DefVar $Version$
DefVar $Inst_Cmd32$
DefVar $Inst_Cmd64$
DefVar $Inst_Prg$
DefVar $Uninst_Cmd$
DefVar $Uninst_Prg$
DefVar $InstDest$
DefVar $RegName$
DefVar $RegValue$
DefVar $FireWallRulesPath$
DefVar $UDPPort$
DefVar $TCPPort$
DefVar $TCPRulesname$
DefVar $UDPRulesName$
DefVar $TCPRule$
DefVar $UDPRule$
DefVar $CompValue$
 
Sub_OS_Detect
 
Set $INST_SystemType$ = $Systemtype$
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $UDPPort$ = GetProductProperty("UDPPort","4000")
Set $TCPPort$ = GetProductProperty("TCPPort","4000")
 
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$       = "ThinPrint"
Set $Version$         = "2011"
Set $MinimumSpace$    = "50 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\ThinPrint Client"
Set $InstallDir64$      = "%ProgramFiles64Dir%\ThinPrint Client"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $Inst_Prg$ = "msiexec.exe"
Set $Inst_Cmd32$ = '/qb /i "%ScriptPath%\files\TPTCP_x86_deu\ThinPrint\TPTCP_x86_deu.msi" CITRIXCLIENT-DIR="%ProgramFiles32Dir%\Citrix\ICA Client" /quiet'
Set $Inst_Cmd64$ = '/qb /i "%ScriptPath%\files\TPTCP_x64_deu\ThinPrint\TPTCP_x64_deu.msi" CITRIXCLIENT-DIR="%ProgramFiles64Dir%\Citrix\ICA Client" /quiet'
Set $Uninst_Cmd$ = ""
Set $Uninst_Prg$ = ""
Set $FirewallRulesPath$ ="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy"
; ----------------------------------------------------------------
 
;c:\Windows\System32\msiexec /qb /i "c:\install\ThinPrintClient Windows 8.6.msi" ADDLOCAL="ICA" CITRIXCLIENT-DIR="C:\Program Files\Citrix\ICA Client"
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".jpg" $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
 
;       if FileExists("%ScriptPath%\delsub.ins")
;               comment "Start uninstall sub section"
;               Sub "%ScriptPath%\delsub.ins"
;       endif
 
        if $LicenseRequired$ = "true"
                comment "Licensing required, reserve license and get license key"
                Sub_get_licensekey
        endif
 
        comment "Installiere ThinPrint Client 8.0 ICA..."
	message "Check set for Firewall-Rules"
	;Check the System-Version to configure the Firewall
	if ($MSOS$ = "5.1")
		set $FirewallRulesPath$ = "[" + $FirewallRulesPath$ + "\DomainProfile\GloballyOpenPorts\List]"
		Set $TCPRulesName$ = $TCPPort$ + ":TCP"
		Set $TCPRule$ = $TCPPort$ + ":TCP:*:Enabled:ThinClient TCP"
		Set $UDPRulesName$ = $UDPPort$ + ":UDP"
		Set $UDPRule$ = $UDPPort$ + ":UDP:*:Enabled:ThinClient UDP"
	else
		set $FirewallRulesPath$ = "[" + $FirewallRulesPath$ + "\FirewallRules]"
		Set $TCPRulesName$ = "{15B415D5-76C8-4F51-A346-F84B9D0E040B}"
		Set $TCPRule$ = "v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Domain|LPort=" + $TCPPort$ + "|Name=Thinprint TCP|"
		Set $UDPRulesName$ = "{68A18B74-453D-4C73-BE39-805005537059}"
		Set $UDPRule$ = "v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=17|Profile=Domain|LPort=" + $UDPPort$ + "|Name=Thinprint UDP|"
	endif
	DefVar $RegCheck$
        Set $RegCheck$ =  $FirewallRulesPath$+" "+$TCPRulesName$       
	set $CompValue$ = GetRegistryStringValue ($RegCheck$)
	if not($CompValue$ ="")
		message "Schlüssel vorhanden"
		Registry_Modify_TP
	else
		Registry_Add_TP
		message "Key created"
	endif
 
        if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
                Message "Installiere " + $ProductId$ + ". Das kann etwas laenger dauern, bitte Geduld..."
                comment "Start setup program"
                if (FileExists("%ProgramFilesSysnativeDir%\Citrix\ICA Client\pn.exe"))
                	comment "installing the plugin"
			Winbatch_install_32
                endif
;                comment "patch the Userprofil"
;                Set $InstDest$ = "%CurrentProfileDir%"
;                Files_Patch_UserProfil
;                if not(fileExists("%DefaultUserProfileDir%\AppData\Roaming\ICAClient\wfcwin32.log"))
;                	comment "patch the default User5Profile"
;                	Set $InstDest$ = "%DefaultUserProfileDir%"
;                	Files_Patch_UserProfil
;                endif
                comment "ceck the return arguments"
                Sub_check_exitcode
        endif
 
        if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
                Message "Installiere " + $ProductId$ + ". Das kann etwas laenger dauern, bitte Geduld..."
                comment "Start setup program"
                if not (FileExists("%ProgramFilesSysnativeDir%\Citrix\ICA Client\pn.exe"))
                	comment "installing the plugin"
			Winbatch_install_64
                endif
;                comment "patch the Userprofil"
;                Set $InstDest$ = "%CurrentProfileDir%"
;                Files_Patch_UserProfil
;                if not(fileExists("%DefaultUserProfileDir%\AppData\Roaming\ICAClient\wfcwin32.log"))
;                	comment "patch the default User5Profile"
;                	Set $InstDest$ = "%DefaultUserProfileDir%"
;                	Files_Patch_UserProfil
;                endif
                comment "ceck the return arguments"
                Sub_check_exitcode
        endif
 
endif
;add the firewall - rules for ThinPrint
[Registry_Add_TP]
openkey $FirewallRulesPath$
Add "$TCPRulesName$"=REG_SZ:"$TCPRule$"
Add "$UDPRulesName$"=REG_SZ:"$UDPRule$"
 
;if existing predefined rules, delete the rules and add the new rules
[Registry_Modify_TP]
openkey $FirewallRulesPath$
DeleteVar "$TCPRulesName$"
DeleteVar "$UDPRulesName$"
Add "$TCPRulesName$"=REG_SZ:"$TCPRule$"
Add "$UDPRulesName$"=REG_SZ:"$UDPRule$"
;retrieve the data for the system
[Sub_OS_Detect]
	Set $OS$ = GetOS
	if $OS$ = "Windows_NT"
	  Set $NTVersion$ = GetNTVersion
	endif
	set $MSOS$ = GetMSVersionInfo
	set $Systemtype$ = GetSystemtype
 
 
[Winbatch_install_32]
; Choose one of the following examples as basis for your installation
; You can use $LicenseKey$ var to pass a license key to the installer
;
; === Nullsoft Scriptable Install System ================================================================
"$Inst_Prg$" $Inst_Cmd32$
 
[Winbatch_install_64]
; Choose one of the following examples as basis for your installation
; You can use $LicenseKey$ var to pass a license key to the installer
;
; === Nullsoft Scriptable Install System ================================================================
"$Inst_Prg$" $Inst_Cmd64$
 
[Files_delete_32]
; Example of recursively copying some files into the installation directory:
;
;copy "%ScriptPath%\config.xml" "$InstallTmpDir$\$INSTVersion$.WW"
 
[Files_Install_Copy]
; copy the installationCD to the local HD
 
;copy -s "%ScriptPath%\files\*.*" "$InstallTmpDir$"
;copy "%ScriptPath%\config.xml" "$InstallTmpDir$\$INSTVersion$.WW"
 
[Files_Patch_UserProfil]
 
;copy -s "%ScriptPath%\files\ICAClient_User\*.*" "$InstDest$\AppData\Roaming\ICAClient"
;copy -s "%ScriptPath%\files\Cache_local\*.*" "$InstDest$\AppData\local\ICAClient\Cache"
 
[Sub_get_licensekey]
comment "License management is enabled and will be used"
 
comment "Trying to get a license key"
Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
; If there is an assignment of exactly one licensepool
; to the product the following call is possible:
; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
;
; If there is an assignment of a license pool
; to a windows software id, it is possible to use:
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
 
DefVar $ServiceErrorClass$
set $ServiceErrorClass$ = getLastServiceErrorClass
comment "Error class: " + $ServiceErrorClass$
 
if $ServiceErrorClass$ = "None"
        comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
else
        if $ServiceErrorClass$ = "LicenseConfigurationError"
                LogError "Fatal: license configuration must be corrected"
                LogError getLastServiceErrorMessage
                isFatalError
        else
                if $ServiceErrorClass$ = "LicenseMissingError"
                        LogError "Fatal: required license is not supplied"
                        isFatalError
                endif
        endif
endif
 
[Registry_Add_Firewall]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules]
Add "$RegName$"=REG_SZ:"$RegValue$"
 
[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"
                comment "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"
                                comment "complete the install. This message is indicative of a success."
                        else
                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: "
                                logError $ExitCode$
                                isFatalError
                        endif
                endif
        endif
endif
 
[XMLPatch_config]
OpenNodeSet
- error_when_no_node_existing false
- warning_when_no_node_existing true
- error_when_nodecount_greater_1 false
- warning_when_nodecount_greater_1 true
- create_when_node_not_existing true
- attributes_strict false
 
documentroot
all_childelements_with:
elementname: "PIDKEY"
attribute: "Value" value="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
end
SetAttribute  "Value"  value="$LicenseKey$"

uninstall.ins

[Initial]
LogLevel=9
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $Version$
DefVar $MinimumSpace$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
Defvar $InstallTmpDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $Uninst_Cmd$
DefVar $Uninst_Prg$
DefVar $INSTVersion$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       	= "ThinPrint"
Set $Version$         	= "2011"
Set $MinimumSpace$    	= "50 MB"
Set $InstallDir32$    	= "%ProgramFiles32Dir%\ThinPrint Client"
Set $InstallDir64$    	= "%ProgramFiles64Dir%\ThinPrint Client"
Set $LicenseRequired$ 	= "false"
Set $LicensePool$     	= "p_" + $ProductId$
Set $Uninst_Prg$        = "MsiExec.exe"
Set $Uninst_Cmd$        = " /X{4A7DCE09-9A5A-4A75-ACA5-98D13D400816} /quiet"
; the correct uninstall command you are looked in the registry under the Hive
; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".jpg" $ProductId$
 
Message "Deinstalliere " + $ProductId$ + ". Bitte etwas Geduld..."
 
if (FileExists("%ProgramFilesSysnativeDir%\ThinPrint Client\Thnclnt32deu.dll"))
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub.ins"
	comment "delete the default and the user profile data"
;	Files_Delete_UserProfil
 
else
	comment "modul not installed"
	isFatalError
endif	
 
 
if $LicenseRequired$ = "true"
        comment "Licensing required, free license used"
        Sub_free_license
endif
 
ExitWindows /reboot
 
[Files_Delete_UserProfil]
 
delete -s "%CurrentProfileDir%\AppData\Roaming\ICAClient"
delete -s "%CurrentProfileDir%\AppData\local\ICAClient\Cache"
delete -s "%DefaultUserProfileDir%\AppData\Roaming\ICAClient"
delete -s "%DefaultUserProfileDir%\AppData\local\ICAClient\Cache"
 
[Sub_free_license]
comment "License management is enabled and will be used"
 
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)

delsub.ins

if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
        Message "Uninstalling " + $ProductId$ + " 32 Bit..."
        comment "Uninstall program found, starting uninstall"
        Winbatch_uninstall_32
        sub_check_exitcode
        endif
 
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
        Message $ProductId$ + " ist nur fuer 32 Bit..."
        comment "Fatal: Nur fuer 32 Bit OS!"
        isFatalError
endif
 
[Winbatch_uninstall_32]
 
$Uninst_Prg$ $Uninst_Cmd$ 
 
[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
                        	if ($ExitCode$ = "30066")
                        		comment "looks good: setup program means that the install-Source are corrupted"
                        	else
                        		logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
                        		isFatalError
                        	endif
                        endif
                endif
        endif
endif