User Tools

Site Tools


userspace:java

This is an old revision of the document!


Table of Contents

Java

Thanks to Der-Matze
Comments and improvements welcome

Tested with opsi 4.0.1
Tested with opsi-winst 4.10.x - 4.11.1.6
Tested with Windows XP Professional

This script uses the check_msi-exitcode script: https://forum.opsi.org/wiki/userspace:check_msi-exitcode

Uninstall.ins deinstalls all Versions of Java from 1.5.0.x until 1.6.0.31.
Because of the nesting of the subs, it is not possible to outsource the code in subuninstall.ins

install.ins

uninstall.ins

[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"
 
;the variable for the ExitCode
DefVar $ExitCode$
 
;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$
 
;Stingliste for the different Versions of Java
DefStringList $version15$
DefStringList $version16_1$
DefStringList $version16_2$
set $version15$ = createStringList ('01','02', '03', '04', '05', '06', '07','08', '09', '10', '11', '12', '13','14', '15', '16','17', '18', '19', '20', '21', '22')
set $version16_1$ = createStringList ('01','02', '03', '04', '05', '06', '07')
;there is no Java 1.6.0 Update 8 or 9
;there are different Uninstall-Strings betweeen Version 10 and Version 20 (ends with F0)
set $version16_2$ = createStringList ('10', '11', '12', '13', '14', '15', '16', '17' , '18' , '19' , '20')
;Uninstall String (ends with FF)
set $version16_3$ = createStringList ('10','11', '12', '13', '14', '15', '16', '17' , '18' , '19' , '20', '21', '22' , '23' , '24' , '25', '26', '27' , '28' , '29' , '30', '31')
 
killtask "java.exe"
killtask "javaw.exe"
killtask "jqs.exe"
 
for $x$ in $version15$ do sub_patch_uninstall_15
for $x$ in $version16_1$ do sub_patch_uninstall_16_1
for $x$ in $version16_2$ do sub_patch_uninstall_16_2
for $x$ in $version16_3$ do sub_patch_uninstall_16_3
 
 
[sub_patch_uninstall_15]
;Java 1.5.0.XX deinstallieren
Set $DisplayName$ = GetRegistrystringvalue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3248F0A8-6813-11D6-A77B-00B0D0150$x$0}] DisplayName")
if not ($DisplayName$ = "")
	Message "Deinstalling "+$DisplayName$
	set $UninstallCommand$ = "MsiExec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0150$x$0} /qb-! REBOOT=ReallySuppress"
	Winbatch_Uninstall
	sub "%ScriptDrive%\install\check_exitcode\check_msi-exitcode.ins"
endif
 
[Winbatch_Uninstall]
$UninstallCommand$
 
[sub_patch_uninstall_16_1]
;Java 1.6.0.XX deinstallieren
Set $DisplayName$ = GetRegistrystringvalue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3248F0A8-6813-11D6-A77B-00B0D0160$x$0}] DisplayName")
if not ($DisplayName$ = "")
	Message "Deinstalling "+$DisplayName$
	set $UninstallCommand$ = "MsiExec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160$x$0} /qb-! REBOOT=ReallySuppress"
	Winbatch_Uninstall
	sub "%ScriptDrive%\install\check_exitcode\check_msi-exitcode.ins"
endif
 
 
 
[sub_patch_uninstall_16_2]
;Java 1.6.0.XX deinstallieren
Set $DisplayName$ = GetRegistrystringvalue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F832160$x$F0}] DisplayName")
if not ($DisplayName$ = "")
	Message "Deinstalling "+$DisplayName$
	set $UninstallCommand$ = "MsiExec.exe /x {26A24AE4-039D-4CA4-87B4-2F832160$x$F0} /qb-! REBOOT=ReallySuppress"
	Winbatch_Uninstall
	sub "%ScriptDrive%\install\check_exitcode\check_msi-exitcode.ins"
endif
 
[sub_patch_uninstall_16_3]
;Java 1.6.0.XX deinstallieren
Set $DisplayName$ = GetRegistrystringvalue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F832160$x$FF}] DisplayName")
if not ($DisplayName$ = "")
	Message "Deinstalling "+$DisplayName$
	set $UninstallCommand$ = "MsiExec.exe /x {26A24AE4-039D-4CA4-87B4-2F832160$x$FF} /qb-! REBOOT=ReallySuppress"
	Winbatch_Uninstall
	sub "%ScriptDrive%\install\check_exitcode\check_msi-exitcode.ins"
endif
userspace/java.1334733701.txt.gz · Last modified: 2021/08/23 08:37 (external edit)