Seite 1 von 1

Java 7u55 32/64bit gleichzeitig auf ein Gerät installieren

Verfasst: 25 Apr 2014, 15:29
von opsi.simi
Hallo Opsi-Gemeinschaft,

ich stehe mal wieder vor einem kleinen Problem oder aufem Schlauch :mrgreen:

und zwar hab ich es endlich geschafft mir eine install.ins & uninstall.ins für JAVA 7u55 zu schreiben,
leider bin ich jetzt bei einem Client auf das Phänomen gestoßen das wenn ich mein Paket verteile,
das gewisse Seiten wie z.b.: vom Zoll nicht richtig geladen wird und ich das Formular nicht sehe.
Dieses Formular wird, wie sollte es anders sein mit Java geladen, was ich installiert habe, wird mir aber trotzdem nicht aufgerufen :(

nach ewig langem Gesuche habe ich herausgefunden das es an der Version liegt.
Ich hatte JAVA 7u55 64bit installiert und damit kam weder der Internet Explorer 11 noch der Firefox 24.4.0 klar :/
so weit so gut, ich die 64bit Installation wieder runter geschmissen und das Paket auf 32bit umgebaut
und dann verteilt. Siehe da es geht!

Jetzt zu meiner Frage wie kann ich das Java scribt so umbauen das ich gleichzeitig 32 & 64 bit auf einen Client verteilen kann
und dann wär mir am liebsten wenn man aus dem install.ins scribt alte Versionen deinstallieren kann.
Bis jetzt muss ich immer erst die uninstall aufem opsi-config-editor ausführen um alte Versionen zu deinstallieren
und dann install um die neue Version zu verteilen.

Anbei mein Setup.ins:

Code: Alles auswählen

[Initial]
;Standard Text, der während der Installation angezeigt wird
Message = Bitte warten, das Produkt wird installiert
;Loglevel einstellen
setLogLevel = 6
;Bei Fehlern abbrechen
ExitOnError = false
;Syntax Fehler werden in einem separaten Fenster angezeigt
ScriptErrorMessages = on
;Single-Step Mode nicht verwenden
TraceMode = off
;Im Batchmode das Winst-Fenster nicht im Vordergrund anzeigen
StayOnTop = false
 
[Actions]
;Variable für die Ermittlung des Betriebssystems
DefVar $OS$
set $OS$ = GetOS
 
;Variable für die Ermittlung der Betriebssystem Unterversion
DefVar $NTVersion$
set $NTVersion$ = GetNTVersion
 
;Variable zur Ermittlung der Systemarchitektur
DefVar $SystemType$
Set $SystemType$ = GetSystemType
 
;Name des Produkts (max. 12 Zeichen)
DefVar $ProductName$
Set $ProductName$ = "Java"
 
;Vollständiger Produktname incl. Versionsnummer
 
DefVar $ProductNameFull1$
set $ProductNameFull1$ = "Java 1.7 Update 55"
 
;Dateiname des Produktbildes mit Erweiterung
DefVar $ProductPicture$
Set $ProductPicture$ = "java.png"
 
DefVar $Executable32$
DefVar $Executable64$
Set $Executable32$ = "jre-7u55-windows-i586.exe"
Set $Executable64$ = "jre1.7.0_55.msi"
 
;Die Variable zur Auswertung des ExitCodes
DefVar $ExitCode$
 
;Prüfen der Winst Version
requiredWinstVersion >= "4.11"
 
;$ProductPicture$ und $ProductName$ anzeigen
ShowBitmap /3 "%scriptpath%\" + $ProductPicture$ $ProductName$
 
;Anzeigen der Installationsbenachrichtigung incl. des vollen Produktnamens
Message "Installiere "+$ProductNameFull1$
 
;Freien Speicherplatz ermitteln
if not (HasMinimumSpace ("%SYSTEMDRIVE%", "100 MB"))
     LogError "Nicht genügend Platz auf %SYSTEMDRIVE%"
     isFatalError
endif

;OS-Version ermitteln
if ( $NTVersion$ = "Win2K" OR $NTVersion$ = "WinXP" OR $NTVersion$ = "Win NT 5.2" OR $NTVersion$ = "Windows Vista" )
    if $SystemType$ = "x86 System"
	Winbatch_Install_32-Bit
    endif
    if $SystemType$ = "64 Bit System"
	Winbatch_Install_64-Bit
    endif
else
        LogError "Kein kompatibles Betriebssystem installiert"
	isFatalError
endif
 
[Winbatch_Install_32-Bit]
"%ScriptPath%\$Executable32$" /qn
 
[Winbatch_Install_64-Bit]
msiexec /i "%SCRIPTPATH%\$Executable64$" /qn reboot=reallysuppress

unistall.ins:

Code: Alles auswählen

[Initial]
Message = Bitte warten, Java wird Deinstalliert
setLogLevel = 6
ExitOnError = false
ScriptErrorMessages = on
TraceMode = off
StayOnTop = false
 
[Actions]
;Variable for the OS
DefVar $OS$
Set $OS$ = GetOS
 
;Variable for the OS-subversion
DefVar $NTVersion$
Set $NTVersion$ = GetNTVersion
 
;Name of product (max. 12 columns)
DefVar $ProductName$
Set $ProductName$ = "Java"
 
;filename of productpicture with extension
DefVar $ProductPicture$
Set $ProductPicture$ = "java.png"
 
;show $ProductPicture$ and $ProductName$
ShowBitmap /3 "%scriptpath%\" + $ProductPicture$ $ProductName$
 
;Variable for the msiexec-call for deinstallation
DefVar $UninstallCommand$
 
;Variable for the current version. Will be read from registry.
DefVar $DisplayName$

killtask "java.exe"
killtask "javaw.exe"
killtask "jqs.exe"

if FileExists("%ProgramFiles32Dir%\Java\jre6\")
              comment "Start uninstalling old version"
			Winbatch_Uninstall_Java_32
			Registry_KeysLoeschen_Java_32
      endif
if FileExists("%ProgramFiles32Dir%\Java\jre7\")
              comment "Start uninstalling old version"
			Winbatch_Uninstall_Java_32
			Registry_KeysLoeschen_Java_32
      endif
if FileExists("%ProgramFiles64Dir%\Java\jre6\")
              comment "Start uninstalling old version"
			Winbatch_Uninstall_Java_64
			Registry_KeysLoeschen_Java_64
      endif
if FileExists("%ProgramFiles64Dir%\Java\jre7\")
              comment "Start uninstalling old version"
			Winbatch_Uninstall_Java_64
			Registry_KeysLoeschen_Java_64
      endif

[Winbatch_Uninstall_Java_32]
;REM JRE Runtime Environment 1.5 Update 14
msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150140}  /qb-! REBOOT=Suppress
;REM JRE Runtime Environment 1.6 Update 12
msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216012FF}  /qb-! REBOOT=Suppress
;REM JRE Runtime Environment 1.7 Update 45
msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217045FF}  /qb-! REBOOT=Suppress
;REM JRE Runtime Environment 1.7.0 Update 51 
msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217051FF}  /qb-! REBOOT=Suppress
;REM JRE Runtime Environment 1.7.0 Update 55
msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217055FF}  /qb-! REBOOT=Suppress

[Winbatch_Uninstall_Java_64]
;REM JRE Runtime Environment 1.7 Update 45
msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417045FF}  /qb-! REBOOT=Suppress
;REM JRE Runtime Environment 1.7.0 Update 51 
msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417051FF}  /qb-! REBOOT=Suppress
;REM JRE Runtime Environment 1.7.0 Update 55
msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417055FF}  /qb-! REBOOT=Suppress

Re: Java 7u55 32/64bit gleichzeitig auf ein Gerät installier

Verfasst: 25 Apr 2014, 15:40
von ueluekmen
Einfachste Antwort: Kauf dir das Standardabo, da ist das Out-Of-The-Box:

http://uib.de/de/support-schulung/update-abonnements/

Zweite Möglichkeit, wenn du dir so etwas selber bauen willst, dann solltest du die opsi-templates verwenden. (Sind als opsi-Paket über download.uib.de verfügbar)

Dritte Möglichkeit: Du besucht einer unserer Schulungen:

http://uib.de/de/support-schulung/schulung/

Die nächsten Termine sind:

Schulung Mainz 05.05. - 08.05.2014 (KW 19)
Schulung Mainz 02.06. - 05.06.2014 (KW 23)
Schulung Linuxhotel (3-Tage) 02.07. - 04.07.2014 (KW 30)

Re: Java 7u55 32/64bit gleichzeitig auf ein Gerät installier

Verfasst: 07 Mai 2014, 16:12
von hadro
Mein JAVA Install sieht so aus: - Hier wird java 32 und 64 bit installiert. Bei der 32 bit version hab ich nur ältere varianten. Die müsstest du wohl nur ersetzen. Beachte aber auch die Setup Parameter - die haben sich glaubsch von den Versionen her geändert.
Oder versteh ich dein Problem falsch? :D Dann entschuldige den SPAM...

http://java.com/de/download/windows_offline.jsp

http://java.com/de/download/manual.jsp

[Damit ich mich nicht mit fremden Lorbeeren schmücke. Das Script basiert auf dem im WIKI stehendem Script.

SETUP.INS

Code: Alles auswählen

[Actions]
DefVar $OS$
DefVar $NTVersion$
DefVar $SystemType$
DefVar $architecture$
DefVar $ProductName$
DefVar $ProductNameFull1$
DefVar $ProductPicture$
DefVar $Executable32_1$
DefVar $Executable32_2$
DefVar $Executable64$
DefVar $ExitCode$

set $OS$ = GetOS
set $NTVersion$ = GetNTVersion
Set $SystemType$ = GetSystemType
Set $architecture$ = GetProductProperty("architecture","Both")
Set $ProductName$ = "javare"
set $ProductNameFull1$ = "Java Runtime Edition"
Set $ProductPicture$ = "java.jpg"
Set $Executable32_1$ = "jre1.6.0_16.msi"
Set $Executable32_2$ = "jre1.6.0_33.msi"
Set $Executable64$ = "jre-7u55-windows-x64.exe"

requiredWinstVersion >= "4.11"
 
ShowBitmap /3 "%scriptpath%\" + $ProductPicture$ $ProductNameFull1$
 
Message "Installiere "+$ProductNameFull1$
 
if not (HasMinimumSpace ("%SYSTEMDRIVE%", "300 MB"))
     LogError "Nicht genügend Platz auf %SYSTEMDRIVE%"
     isFatalError
endif
 
if ( $NTVersion$ = "Win2K" OR $NTVersion$ = "WinXP" OR $NTVersion$ = "Win NT 5.2" OR $NTVersion$ = "Windows Vista" )
    if $SystemType$ = "x86 System"
		if ($architecture$ = "Both")
			comment Falsche Prozessorarchitektur! Nur x86 Installation moeglich!
			Winbatch_Install_32-Bit
		endif
		if ($architecture$ = "x64")
			comment Falsche Prozessorarchitektur! x64 Installation nicht moeglich!
		endif
		if ($architecture$ = "x86")
			Winbatch_Install_32-Bit
		endif
    endif
    if $SystemType$ = "64 Bit System"
		if ($architecture$ = "Both")
			Winbatch_Install_32-Bit
			Winbatch_Install_64-Bit
		endif
		if ($architecture$ = "x64")
			Winbatch_Install_64-Bit
		endif
		if ($architecture$ = "x86")
			Winbatch_Install_32-Bit
		endif
    endif
else
        LogError "Kein kompatibles Betriebssystem installiert"
	isFatalError
endif
 
[Winbatch_Install_32-Bit]
msiexec /i %SCRIPTPATH%\6_16_x86\$Executable32_1$ ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=REALLYSUPPRESS AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0 CUSTOM=1 WEB_JAVA_SECURITY_LEVEL=M /qn
msiexec /i %SCRIPTPATH%\6_33_x86\$Executable32_2$ ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=REALLYSUPPRESS AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0 CUSTOM=1 WEB_JAVA_SECURITY_LEVEL=M /qn

[Winbatch_Install_64-Bit]
%SCRIPTPATH%\7_55_x64\$Executable64$ /s /v"ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=REALLYSUPPRESS AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0 CUSTOM=1 WEB_JAVA_SECURITY_LEVEL=M /qn"
uninstall.ins

Code: Alles auswählen

[Initial]
Message = Bitte warten, Java wird deinstalliert
setLogLevel = 6
ExitOnError = false
ScriptErrorMessages = on
TraceMode = off
StayOnTop = false
 
[Actions]
DefVar $ProductName$
Set $ProductName$ = "javare"
DefVar $ProductNameFull1$
set $ProductNameFull1$ = "Java Runtime Edition"
DefVar $ProductPicture$
Set $ProductPicture$ = "java.jpg"
DefVar $ExitCode$
 
ShowBitmap /3 "%ScriptPath%\" + $ProductPicture$ $ProductNameFull1$
 
killtask "java.exe"
killtask "javaw.exe"
killtask "jqs.exe"
killtask "iexplore.exe"
killtask "firefox.exe"
killtask "chrome.exe"

DosInAnIcon_java_uninstall

[DosInAnIcon_java_uninstall]
call "%ScriptPath%\javauninstall.bat"

javauninstall.bat

Code: Alles auswählen

wmic product where "name like 'Java(TM) 6%%'" call uninstall /nointeractive
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive
OPSI/control

Code: Alles auswählen

[Package]
version: 2
depends: 
incremental: False

[Product]
type: localboot
id: javare
name: Java Runtime Edition (6u16 x86 / 6u33 x86) und (7u55 x64)
description: 
advice: Java Programme und Browser (iexplore.exe, firefox.exe, chrome.exe) werden automatisch beendet!
version: 7.55
priority: 0
licenseRequired: False
productClasses: 
setupScript: setup.ins
uninstallScript: uninstall.ins
updateScript: 
alwaysScript: 
onceScript: 
customScript: 
userLoginScript: 

[ProductProperty]
type: unicode
name: architecture
multivalue: False
editable: True
values: ["Both", "x64", "x86"]
default: ["Both"]


gruß
hadro

Re: Java 7u55 32/64bit gleichzeitig auf ein Gerät installier

Verfasst: 15 Mai 2014, 21:13
von achim71
hadro hat geschrieben:
javauninstall.bat

Code: Alles auswählen

wmic product where "name like 'Java(TM) 6%%'" call uninstall /nointeractive
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive
gruß
hadro
Merci, sehr praktisches Snippet!

Re: Java 7u55 32/64bit gleichzeitig auf ein Gerät installier

Verfasst: 26 Mai 2014, 22:42
von SisterOfMercy
I always install the 32-bit version on a 64-bit operating system. Mozilla Firefox is 32-bit, and other programs can use the 64-bit version.

This is my version:

setup3264.ins

Code: Alles auswählen

; 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/en/credits/
;
; License Management removed


[Actions]
requiredWinstVersion >= "4.10.8.6"

;DefVar $MsiId32$
;DefVar $UninstallProgram32$
;DefVar $MsiId64$
;DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
;DefVar $InstallDir32$
;DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $INST_SystemType$
;DefVar $INST_architecture$
DefVar $INST_MsVersion$

set $INST_MsVersion$ = GetMsVersionInfo
Set $INST_SystemType$ = GetSystemType
;set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
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$       = "java-runtime"
Set $MinimumSpace$    = "500 MB"
; the path were we find the product after the installation
;Set $InstallDir32$      = "%ProgramFiles32Dir%\<path to the product>"
;Set $InstallDir64$      = "%ProgramFiles64Dir%\<path to the product>"
; ----------------------------------------------------------------

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
endif
if $INST_MsVersion$ < "5.1"
	LogError "Windows XP or newer is required for " + $ProductId$  
	isFatalError
endif
	
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

;if FileExists("%ScriptPath%\delsub3264.ins")
;	comment "Start uninstall sub section"
;	Sub "%ScriptPath%\delsub3264.ins"
;endif
	
comment "installing"

if ($INST_SystemType$ = "x86 System") 
;and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Installing " + $ProductId$ + "..."
	comment "Start setup program"
	Winbatch_install_32
	Sub_check_exitcode
	comment "Copy files"
	Files_install_32 /32Bit
	comment "Patch Registry"
	Registry_install /32Bit
	Registry_install_AllProfiles /AllNTUserDats
	comment "Create shortcuts"
	LinkFolder_install
endif

if ($INST_SystemType$ = "64 Bit System") 
;and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Installing " + $ProductId$ + "..."
	comment "Start setup program"
	Winbatch_install_64
	Sub_check_exitcode
	Winbatch_install_32
	Sub_check_exitcode
	comment "Copy files"
	Files_install_64 /64Bit
	comment "Patch Registry"
	Registry_install /64Bit
	Registry_install /32Bit
	Registry_install_AllProfiles /AllNTUserDats
	comment "Create shortcuts"
	LinkFolder_install
endif
	

[Winbatch_install_32]
; Install Java Runtime
;"%ScriptPath%\files\jre-7u55-windows-i586.exe" /s IEXPLORER=1 MOZILLA=1 ADDLOCAL=ALL JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 JQS=0 SYSTRAY=0 EULA=0 REBOOT=Suppress
"%SystemRoot%\system32\msiexec.exe" /qb! /package "%ScriptPath%\files\x86\jre1.7.0_55.msi" IEXPLORER=1 MOZILLA=1 ADDLOCAL=ALL JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 JQS=0 SYSTRAY=0 EULA=0 REBOOT=ReallySuppress

; Get rid of java quick starter
"%ProgramFiles32Dir%\Java\jre7\bin\jqs.exe" -unregister

; Install cacert.org root certificates in java keystore
"%ProgramFiles32Dir%\Java\jre7\bin\keytool.exe" -noprompt -import -alias cacert-root -keystore "%ProgramFiles32Dir%\Java\jre7\lib\security\cacerts" -trustcacerts -file "%ScriptPath%\files\cacert.org-root.der" -storepass "changeit"
"%ProgramFiles32Dir%\Java\jre7\bin\keytool.exe" -noprompt -import -alias cacert-class3 -keystore "%ProgramFiles32Dir%\Java\jre7\lib\security\cacerts" -trustcacerts -file "%ScriptPath%\files\cacert.org-class3.der" -storepass "changeit"
 
; Disable %ProgramFiles32Dir%\Java\jre7\bin\jp2ssv.dll
"%ScriptPath%\files\x86\shexview.exe" /disable {DBC80044-A445-435b-BC74-9C25C1C588A9}
; Disable %ProgramFiles32Dir%\Java\jre7\bin\ssv.dll
"%ScriptPath%\files\x86\shexview.exe" /disable {761497BB-D6F0-462C-B6EB-D4DAF1D92D43}

[Files_install_32]
; Get rid of java quick starter
delete -f "%ProgramFiles32Dir%\Java\jre7\bin\jqs.exe"

[Winbatch_install_64]
; Install Java Runtime
;"%ScriptPath%\files\jre-7u55-windows-x64.exe" /s IEXPLORER=1 MOZILLA=1 ADDLOCAL=ALL JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 JQS=0 SYSTRAY=0 EULA=0 REBOOT=Suppress
"%SystemRoot%\system32\msiexec.exe" /qb! /package "%ScriptPath%\files\x64\jre1.7.0_55.msi" IEXPLORER=1 MOZILLA=1 ADDLOCAL=ALL JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 JQS=0 SYSTRAY=0 EULA=0 REBOOT=ReallySuppress

; Install cacert.org root certificates in java keystore
"%ProgramFiles64Dir%\Java\jre7\bin\keytool.exe" -noprompt -import -alias cacert-root -keystore "%ProgramFiles64Dir%\Java\jre7\lib\security\cacerts" -trustcacerts -file "%ScriptPath%\files\cacert.org-root.der" -storepass "changeit"
"%ProgramFiles64Dir%\Java\jre7\bin\keytool.exe" -noprompt -import -alias cacert-class3 -keystore "%ProgramFiles64Dir%\Java\jre7\lib\security\cacerts" -trustcacerts -file "%ScriptPath%\files\cacert.org-class3.der" -storepass "changeit"

; Disable %ProgramFiles64Dir%\Java\jre7\bin\jp2ssv.dll
"%ScriptPath%\files\x64\shexview.exe" /disable {DBC80044-A445-435b-BC74-9C25C1C588A9}
; Disable %ProgramFiles64Dir%\Java\jre7\bin\ssv.dll
"%ScriptPath%\files\x64\shexview.exe" /disable {761497BB-D6F0-462C-B6EB-D4DAF1D92D43}

[Files_install_64]
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"

[Registry_install]
; Remove deployment plugin from Firefox
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins\@java.com/DTPlugin,version=10.55.2]

[Registry_install_AllProfiles]
; Remove stored start menu order
deletekey [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu]

[LinkFolder_install]
; Remove Java from start menu
set_basefolder common_programs
delete_subfolder Java

[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
uninstall3264.ins

Code: Alles auswählen

; 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/en/credits/
;
; License Management removed

[Actions]
requiredWinstVersion >= "4.10.8.6"

;DefVar $MsiId32$
;DefVar $UninstallProgram32$
;DefVar $MsiId64$
;DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
;DefVar $InstallDir32$
;DefVar $InstallDir64$
DefVar $INST_SystemType$
;DefVar $INST_architecture$

Set $INST_SystemType$ = GetSystemType
;set $INST_architecture$ = GetProductProperty("install_architecture","system specific")


Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "java-runtime"
;Set $InstallDir32$    = "%ProgramFiles32Dir%\<path to the product>"
;Set $InstallDir64$    = "%ProgramFiles64Dir%\<path to the product>"
; ----------------------------------------------------------------


comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

Message "Uninstalling " + $ProductId$ + " ..."

if FileExists("%ScriptPath%\delsub3264.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub3264.ins"
endif
delsub3264.ins

Code: Alles auswählen

; 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/en/credits/
;
; License Management removed


DefStringList $result$
DefStringList $result1$
DefVar $appKey$
DefVar $UninstallCommandList$
DefVar $appString$
DefVar $appKeyString$
DefVar $testName$
;DefVar $exeString$

Set $appKeyString$ = "DisplayName"
Set $appString$ = "Java 7"

;Set $MsiId32$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
;Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe"

;Set $MsiId64$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
;Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe"

if ($INST_SystemType$ = "x86 System") 
;and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Uninstalling " + $ProductId$ + "..."
	
	Set $result$ = getRegistryKeyList32("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
	for $app$ in $result$ do Sub_searchApp32
	if not ($UninstallCommandList$ = "")
		set $result1$ = splitString($UninstallCommandList$,"::")
		for $UninstallCommand$ in $result1$ do Winbatch_uninstall_32 /32Bit
		sub_check_exitcode
	endif
 	

;	if FileExists($UninstallProgram32$)
;		comment "Uninstall program found, starting uninstall"
;		Winbatch_uninstall_32
;		sub_check_exitcode
;	endif

;	if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
;		comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
;		Winbatch_uninstall_msi_32
;		sub_check_exitcode
;	endif
	
	comment "Delete files"
	Files_uninstall_32 /32Bit
	Files_install_AllProfiles /AllNtUserProfiles
	comment "Cleanup registry"
	Registry_uninstall /32Bit
	Registry_uninstall_AllProfiles /AllNTUserDats
endif

if ($INST_SystemType$ = "64 Bit System") 
;and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Uninstalling " + $ProductId$ + "..."

	Set $result$ = getRegistryKeyList64("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
	for $app$ in $result$ do Sub_searchApp64
 	if not ($UninstallCommandList$ = "")
		set $result1$ = splitString($UninstallCommandList$,"::")
		for $UninstallCommand$ in $result1$ do Winbatch_uninstall_64 /64Bit
		sub_check_exitcode
	endif

	Set $result$ = getRegistryKeyList32("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
	for $app$ in $result$ do Sub_searchApp32
	if not ($UninstallCommandList$ = "")
		set $result1$ = splitString($UninstallCommandList$,"::")
		for $UninstallCommand$ in $result1$ do Winbatch_uninstall_32 /32Bit
		sub_check_exitcode
	endif

;	if FileExists($UninstallProgram64$)
;		comment "Uninstall program found, starting uninstall"
;		Winbatch_uninstall_64
;		sub_check_exitcode
;	endif

;	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
;		comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
;		Winbatch_uninstall_msi_64
;		sub_check_exitcode
;	endif
	
	comment "Delete files"
	Files_uninstall_64 /64Bit
	Files_install_AllProfiles /AllNtUserProfiles
	comment "Cleanup registry"
	Registry_uninstall /64Bit
	Registry_uninstall /32Bit
	Registry_uninstall_AllProfiles /AllNTUserDats
endif

comment "Delete program shortcuts"
LinkFolder_uninstall

[Winbatch_uninstall_32]
$UninstallCommand$

;[Winbatch_uninstall_msi_32]
;msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress

[Files_uninstall_32]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
; delete -sf "$InstallDir32$\"

[Winbatch_uninstall_64]
$UninstallCommand$

;[Winbatch_uninstall_msi_64]
;msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress

[Files_uninstall_64]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
; delete -sf "$InstallDir64$\"

[Files_install_AllProfiles]
; meuk weghalen in "%UserProfileDir%\Application Data\Sun\"
delete -sf "%UserProfileDir%\Application Data\Sun\"

[Registry_uninstall]
deletekey [HKEY_LOCAL_MACHINE\Software\JreMetrics]

[Registry_uninstall_AllProfiles]

[LinkFolder_uninstall]
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
; delete_subfolder $ProductId$
;
; Example of deleting a shortcut from AllUsers desktop:
;
; set_basefolder common_desktopdirectory
; set_subfolder ""
; delete_element $ProductId$

[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

[Sub_searchApp32]
set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] " + $appKeyString$
Set $testName$ = GetRegistryStringValue32($appKey$)
if contains($testName$,$appString$)
;	set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] UninstallString"
;	Set $testName$ = GetRegistryStringValue32($appKey$)
	;if contains(lower($testName$),lower("MsiExec.exe"))
	set $UninstallCommandList$ = $UninstallCommandList$ + "MsiExec.exe /x " + "$app$" + " /qb-! REBOOT=ReallySuppress::"
	;else
	;	Set $testName$ = unquote($testName$,'"')
	;	Set $testName$ = unquote($testName$,"'")
	;	Set $exeString$ = takeString(0, splitString ($testName$, "exe"))
	;	set $UninstallCommandList$ = $UninstallCommandList$ + $exeString$ + "exe /S::"
	;endif
endif
 
[Sub_searchApp64]
set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] " + $appKeyString$
Set $testName$ = GetRegistryStringValue64($appKey$)
if contains($testName$,$appString$)
;	set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] UninstallString"
;	Set $testName$ = GetRegistryStringValue64($appKey$)
	;if contains(lower($testName$),lower("MsiExec.exe"))
	set $UninstallCommandList$ = $UninstallCommandList$ + "MsiExec.exe /x " + "$app$" + " /qb-! REBOOT=ReallySuppress::"
	;else
	;	Set $testName$ = unquote($testName$,'"')
	;	Set $testName$ = unquote($testName$,"'")
	;	Set $exeString$ = takeString(0, splitString ($testName$, "exe"))
	;	set $UninstallCommandList$ = $UninstallCommandList$ + '"' + $exeString$ + 'exe /S"::'
	;endif
endif
The msi uninstall section was nicked off of the libreoffice script in the opsi wiki. This works great! You do not have to deinstall every possible msi guid, but it searches for the string in $appString$
Also note you do not uninstall java runtime 7 before installing a newer version, otherwise it will complain it needs a reboot.

(mental note: spend some time copying this to the opsi wiki!)