Table of Contents

ETU JavaVM

Versions
Versions By Robert Tauber 2014/12/08

Tested with opsi xxxxx
requiredWinstVersion >= 4.11.4.12 Robert Tauber 2015/03/13

Die Setup-Daten werden unter Q:\Java\jre_#_x32\ und Q:\Java\jre_#_x64\ mit Ordner abgelegt z.B.: Q:\Java\jre_#_x32\jre1.8.0_40\jre1.8.0_40.msi (den Speicher Ort des Netzlaufwerks Q: bestimmt die map_Q.exe ..\opt_pcbin\install\!drivemap\map_Q.exe)

Tree (..\opt_pcbin\install\!drivemap):
map_Q.exe

Tree (Q:\Java):
CopyFolder.exe
jre_#_x32\jre1.8.0_40\jre1.8.0_40.msi
jre_#_x64\jre1.8.0_40_x64\jre1.8.0_40.msi

Tree (..\Java):
OPSI\control
CLIENT_DATA\javavm.ins
CLIENT_DATA\deljvm.ins
CLIENT_DATA\subdeljava.ins
CLIENT_DATA\Uninstall_Java.exe
CLIENT_DATA\java.png

control

[Package]
version: 2014.12.08
depends: 
incremental: False

[Product]
type: localboot
id: javavm
name: Oracle Java Runtime Environment
description: Java 7
advice: 
version: 0
priority: 0
licenseRequired: False
productClasses: jre
setupScript: javavm.ins
uninstallScript: deljvm.ins
updateScript: 
alwaysScript: 
onceScript: 
customScript: 
userLoginScript: 

[ProductProperty]
type: unicode
name: install_architecture
multivalue: False
editable: False
description: which architecture (32/64 bit) has to be installed
values: ["32 only", "64 only", "both", "system specific"]
default: ["both"]

[ProductProperty]
type: unicode
name: javaversion
multivalue: False
editable: False
description: which version has to be installed (JRE 1.6.x or JRE 7 = 1.7.x)
values: ["jre6", "jre7"]
default: ["jre7"]

CopyFolder.exe / CopyFolder.au3

Kopieren und Umbenennen
Später ermitteln der Version Nummer

#cs ----------------------------------------------------------------------------
 
 AutoIt Version: 3.3.8.1
 Author:         myName
 
 Script Function:
	Template AutoIt script.
 
#ce ----------------------------------------------------------------------------
 
; Script Start - Add your code below here
#include <File.au3>
 
#include <Array.au3>
 
Local $sPath = @ScriptDir
Local $aPath = StringSplit( @ScriptDir, "\" )
Local $sPathTo = "C:\Temp\" & $aPath[$aPath[0]]
local $extention = ".msi"
 
;_ArrayDisplay($sFolderList, "$Folderolder")
 
;MsgBox ( 1, "Zeil Pfad", $sPathTo  )
DirRemove ( $sPathTo , 1 )
 
Local $sFolderList = _FileListToArray($sPath , "*" , 2 )
local $i = 0
For $i = 1 to $sFolderList[0]
 
   Local $sFileList = _FileListToArray($sPath & "\" & $sFolderList[$i]  , "jre*" , 2 )
   if $sFileList <> 0 Then
	  if $sFileList[0] = 1 Then
		 ;_ArrayDisplay($sFileList, "$sFileList")
		 $sFrom = $sPath & "\" & $sFolderList[$i] & "\" & $sFileList[$sFileList[0]]
		 $sTo = $sPathTo & "\" & $sFolderList[$i]
		 DirCopy ( $sFrom, $sTo, 9 )
		 ;DirRemove ( $sFrom ,1 )
		 ;MsgBox ( 1, "OK", $sFrom & " => " & $sTo & "  " & @error )
	  Else
		 MsgBox ( 1, "ERROR", "Mehr als ein Subfolder in: " & $sPath & "\" & $sFolderList[$i]  )
		 _ArrayDisplay($sFileList, "$sFileList")
	  EndIf
   Else
	  ;MsgBox ( 1, "No Subfolders in: ", $sPath & "\" & $sFolderList[$i]  )
   endif
 
   Local $sFileList = _FileListToArray($sPathTo & "\" & $sFolderList[$i]  , "*" & $extention , 1 )
   if $sFileList <> 0 Then
	  if $sFileList[0] = 1 Then
		 ;_ArrayDisplay($sFileList, "$sFileList")
		 $sFrom = $sPathTo & "\" & $sFolderList[$i] & "\" & $sFileList[1]
		 $sTo = $sPathTo & "\" & $sFolderList[$i] & "\" & $sFolderList[$i] & $extention
		 FileMove ( $sFrom, $sTo)
		 ;MsgBox ( 1, "OK", $From & " => " & $to  )
	  Else
		 MsgBox ( 1, "ERROR", "Mehr als eine *.MSI in: " & $sPath & "\" & $sFolderList[$i]  )
		 _ArrayDisplay($sFileList, "$sFileList")
	  EndIf
   Else
	  ;MsgBox ( 1, "No *.MSI Files in: ", $sPath & "\" & $sFolderList[$i]  )
   endif
Next
 
Exit

javavm.ins

Ich will das ganze bei Gelegenheit vereinfachen bin aber bisher nicht dazu gekommen

; Robert Tauber in anlenung an Paket von uib gmbh
 
; Update was ist zu tun?
 
; 	1. 	Hol dir die Aktuelle version 32 und 64 bit
; 		http://java.com/de/download/windows_manual.jsp?locale=de
;	2.	Startet die instalation aber klikt nicht auf [Instaliren]
;	3.	Öfnet den Pfaht 
;		C:\Users\%USERNAME%\AppData\LocalLow\Sun\Java
;	4.	Kopirt dort die ortner 
;		jre1.7.0_45
;		jre1.7.0_45_x64
; 		oder so änlich
;	5.	Fügt sie unter 
;		\\OPSI4\opsi_workbench\localboot\javavm\CLIENT_DATA\Java
;		ein
;	6.	Ändere die Variablen so das sie zum neuen Ortner passen
;		set $AktMsi32$ = "jre1.7.0_45.msi"
;		set $AktMsi64$ = $AktMsi32$
;		Set $msi32path$ = "%ScriptPath%\Java\jre1.7.0_45"
;		Set $msi64path$ = "%ScriptPath%\Java\jre1.7.0_45_x64"
;	7.	Teste es :-P
;
 
; Kompatibel für Win 7 
; Vemutlich nicht Kompatibel mit Win 2000
 
; Header der Ursprünglichen pakets
;===========================================
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
 
;see
;http://www.oracle.com/technetwork/java/javase/silent-136552.html
;http://www.oracle.com/technetwork/java/javase/jre-install-137694.html
;===========================================
 
[Aktionen]
requiredWinstVersion >= "4.10.8.3"
setLogLevel = 5
Message "Installing Oracle Java Virtual Machine jre 1.6 or jre 1.7..."
DefVar $ExitCode$
DefVar $INST_MsVersion$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $JAVAVERSION$
DefVar $JAVA32_VER$
DefVar $JAVA64_VER$
DefVar $InstallPlugins$
DefVar $MySystemRoot$
DefVar $success$
DefVar $AktMsi32$
DefVar $AktMsi64$
DefVar $msi32path$
DefVar $msi64path$
DefVar $msiinstall$
DefVar $InstalledJavaExe$
DefVar $Temp$
 
DefVar $WinstRegKey$
DefVar $Flag$
 
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $Flag$ = GetRegistryStringValue32("["+$WinstRegKey$+"] "+"RebootFlag")
 
DefStringlist $INST_MsVersionMap$
 
set $Temp$ = EnvVar("TEMP")
 
Set $INST_SystemType$ = GetSystemType
set $INST_MsVersion$ = GetMsVersionInfo
set $INST_MsVersionMap$ = GetMSVersionMap
set $INST_architecture$ = GetProductProperty("install_architecture","64 only")
; "system specific" "both" "64 only" "32 only"
set $MySystemRoot$ = "%"+"systemroot"+"%"
set $success$ = "true"
 
;set $JAVA32_EXE$="jre-7u25-windows-i586.exe"
;set $JAVA64_EXE$="jre-7u25-windows-x64.exe"
 
set $AktMsi32$ = "jre_#_x32.msi"
set $AktMsi64$ = "jre_#_x64.msi"
Set $msi32path$ = "C:\Temp\Java\jre_#_x32"
Set $msi64path$ = "C:\Temp\Java\jre_#_x64"
 
;set $AktMsi32$ = "jre1.7.0_45.msi"
;set $AktMsi64$ = $AktMsi32$
;Set $msi32path$ = "c:\temp\Java\jre1.7.0_45"
;Set $msi64path$ = "c:\temp\Java\jre1.7.0_45_x64"
;Set $msi32path$ = "%ScriptPath%\Java\jre1.7.0_45"
;Set $msi64path$ = "%ScriptPath%\Java\jre1.7.0_45_x64"
 
set $JAVAVERSION$ = GetProductProperty("javaversion","jre7")
 
set $msiinstall$ = "True"
 
set $InstallPlugins$ = "IEXPLORER=1 MOZILLA=1"
 
;RT: Speicher platz Überprüfen
if not(HasMinimumSpace ("%SYSTEMDRIVE%", "200 MB"))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for Java 1.6 or 1.7"
	isFatalError
	; Stop process and set installation status to failed
endif
 
;RT: Betribssystem ok
if $INST_MsVersion$ < "6.0"
	LogError "Minimum Windows Vista is required for this Skript" 
	isFatalError
endif
 
;RT Bild herzeigen
ShowBitmap "%scriptpath%\java.png" "Oracle Java VM"
 
if not ($Flag$ = "1" )
	Message "Un-Installing Oracle Java Virtual Machine jre 1.6 or jre 1.7..."
	;RT unterprog aufrufen
	;   deinstalirt Java (Umbau auf Auto it skript vieleicht mit exitcode check)
	if FileExists("%ScriptPath%\subdeljava.ins") 
		comment "start uninstall"
		sub "%ScriptPath%\subdeljava.ins"
	endif
	Set $Flag$ = "1"
	Registry_SaveRebootFlag
	ExitWindows /ImmediateReboot
endif
 
if ($Flag$ = "1" )
	comment "installing"
	Set $Flag$ = "0"
    Registry_SaveRebootFlag
	DosInAnIcon_Q
	DosInAnIcon_Copy
 
 
 
	;RT: Instaliert Java 32 
	;    + Beschreibung der daten beschafung
	if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	;RT: da vorher uninstall macht doch nut Firefox sin
		comment "kill a running firefox"
		Message "Installing Oracle Java Virtual Machine 32 bit ..."
 
		killtask "firefox.exe"
		killtask "jqs.exe"
		killtask "java.exe"
		killtask "javaw.exe"
 
		;RT: Scheint notwendig zu sein habs noch net ohne getestet
		if $INST_SystemType$ = "64 Bit System"
			comment "registry hack for silent install 32 bit on 64 Bit Systems"
			; see http://www.myitforum.com/forums/tm.aspx?high=&m=215451&mpage=1#215451
			Registry_redirect_64_profile_image_to_32 /64bit
		endif
 
		if $msiinstall$ = "True"
			Execwith_autoit_close_proxy "%SCRIPTPATH%\autoit3.exe" WINST /letThemGo
			Execwith_autoit_zertifikat  "%SCRIPTPATH%\autoit3.exe" WINST /letThemGo
			;Winbatch_oracle_silent_install_32
			Winbatch_oracle_msi_install_32
			Sub_check_exitcode
		endif
		Message "Check Java Virtual Machine 32 bit ..."
		;RT: weis net was das macht 
		if CompareDotSeparatedNumbers("%WinstVersion%","4.11.2") >= "0"
			includelog "c:\tmp\"+$JAVA32_VER$+"_x86.log" "20"
		endif
 
		Killtask "autoit3.exe"
		;RT: Scheinbar der Zweite teil des "registry hack" zu sein
		if $INST_SystemType$ = "64 Bit System"
			comment "registry hack for silent install 32 bit on 64 Bit Systems"
			Registry_redirect_64_profile_image_to_64 /64bit
		endif
 
		;RT: Überprüfen was instalirt wurde
		Set $InstalledJavaExe$ = "%ProgramFilesDir%\java\" +$JAVAVERSION$ +"\bin\java.exe"
		DOSInAnIcon_java_version
 
		comment "disable auto updater"
		; see http://wpkg.org/Java
		Winbatch_oracle_silent_disable_update
		;Sub_check_exitcode
		Registry_disable_update
		;Files_del
	endif ; 32 Bit
 
 
 
 
	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		comment "kill a running firefox"
		Message "Installing Oracle Java Virtual Machine 64 Bit..."
 
		killtask "firefox.exe"
		killtask "jqs.exe"
		killtask "java.exe"
		killtask "javaw.exe"
 
		if ($INST_MsVersion$ = "6.0") and ("1" < getValue("product_type_nr",$INST_MsVersionMap$)) and ($INST_SystemType$ = "64 Bit System")
			;LogWarning "silent installation on 2008x64 doesn't works at the moment"
			;Files_create_low_dir
			comment "on 2008x64 we working with msi"
			Set $msiinstall$ = "True"
		endif
 
		;killtask "msiexec.exe"
		;killtask "msiexec.exe"
		;killtask "msiexec.exe"
		;killtask "msiexec.exe"
 
		if $msiinstall$ = "True"
			Execwith_autoit_close_proxy "%SCRIPTPATH%\autoit3.exe" WINST /letThemGo
			Execwith_autoit_Wrapper "%SCRIPTPATH%\autoit3.exe" WINST /letThemGo
			Winbatch_oracle_msi_install_64
			Sub_check_exitcode
		endif
 
		if CompareDotSeparatedNumbers("%WinstVersion%","4.11.2") >= "0"
			includelog "c:\tmp\"+$JAVA64_VER$+"_x64.log" "20"
		endif
 
		Killtask "autoit3.exe"
		comment "disable auto updater"
		; see http://wpkg.org/Java
		Registry_disable_update /64Bit
		Set $InstalledJavaExe$ = "%ProgramFiles64Dir%\java\" +$JAVAVERSION$ +"\bin\java.exe"
		DOSInAnIcon_java_version
		;Files_del
	endif ; 64 Bit
 
	if not ($success$ = "true")
		logError "Fatal: one or more installations are failed "
		isFatalError
	endif
 
endif
; zusätzliches File möglich
;if FileExists("%ScriptPath%\custom_ins_dir\custom.ins")
;	sub "%ScriptPath%\custom_ins_dir\custom.ins"
;endif
 
ExitWindows /Reboot
 
 
 
;===============================================================================
 
[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
				set $success$ = "false"
			endif
		endif
	endif
endif
 
[DosInAnIcon_Q]
"p:\!drivemap\map_Q.exe"
[DosInAnIcon_Copy]
"Q:\Java\CopyFolder.exe"
 
 
 
;RT: Autoit Killt nerfige abfragen
[Execwith_autoit_close_proxy]
WinWait("Verbindung","Verbindung")
Sleep(500)
; activating
WinActivate("Verbindung","Verbindung")
send ("!{F4}")
exit
 
[Execwith_autoit_zertifikat]
WinWait("Sicherheitshinweis")
Sleep(500)
; activating
WinActivate("Sicherheitshinweis")
send ("J")
exit
 
; wird im 64 bit teil verwendet
[Execwith_autoit_Wrapper]
WinWait("Error")
Sleep(500)
; activating
WinActivate("Error")
send ("ENTER")
exit
 
;RT: setup mit MSI
[Winbatch_oracle_msi_install_32]
msiexec /i "$msi32path$\$aktmsi32$" /qb! /lie+ "c:\tmp\$JAVA32_VER$_x86.log" ADDLOCAL=ALL $InstallPlugins$  REBOOT=ReallySuppess SYSTRAY=0 JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 ARPURLUPDATEINFO='http://www.opsi.org'
;									/qb!							
[Winbatch_oracle_msi_install_64]
msiexec /i "$msi64path$\$aktmsi64$" /qb! /lie+ "c:\tmp\$JAVA64_VER$_x64.log" ADDLOCAL=ALL $InstallPlugins$  REBOOT=ReallySuppess SYSTRAY=0 JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 ARPURLUPDATEINFO='http://www.opsi.org'
;									/qb!
;RT: vieleicht geht das
[Winbatch_oracle_silent_install_32]
c:\tmp\$JAVA32_EXE$ /s /v"/qb! /lie+ c:\tmp\$JAVA32_VER$_x86.log ADDLOCAL=ALL $InstallPlugins$  REBOOT=ReallySuppess SYSTRAY=0 JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0 ARPURLUPDATEINFO='http://www.opsi.org'"
 
 
;RT Regestry Hack
[Registry_redirect_64_profile_image_to_32]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-18]
set "ProfileImagePath"=REG_EXPAND_SZ:"$MySystemRoot$\syswow64\config\systemprofile"
 
[Registry_redirect_64_profile_image_to_64]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-18]
set "ProfileImagePath"=REG_EXPAND_SZ:"$MySystemRoot$\config\systemprofile"
 
;RT: Welches Java ist drauf?
[DOSInAnIcon_java_version]
"$InstalledJavaExe$" -version
 
[DOSInAnIcon_instalation_abgeschlossen]
@echo off
tasklist |find /i "prog.exe" >nul
:while1
if %errorlevel% == 0 (
    tasklist |find /i "msiexec" >nul
    goto :while1
)
 
echo 1
 
[Winbatch_oracle_silent_disable_update]
;RT: Scheint vorhanden zu sein und zu funktioniren
msiexec /x {4A03706F-666A-4037-7777-5F2748764D10} /qb-!
 
[Registry_disable_update]
;RT: und nochmal updates off
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy]
set "EnableJavaUpdate"=REG_DWORD:0
 
 
 
 
 
 
;RT: wird nicht aufgerufen
[winbatch_start_taskmgr]
taskmgr.exe
 
[Files_del]
delete -sf "c:\temp"
;delete -f "c:\tmp\$aktmsi64$"
;delete -f "c:\tmp\$aktmsi32$"
;delete -f "c:\tmp\Data1.cab"
 
 
[Registry_SaveRebootFlag]
openKey [$WinstRegKey$]
set "RebootFlag" = "$Flag$"

deljvm.ins

erlaubt es die subdeljava. als uninstall aufzurufen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
 
[Aktionen]
requiredWinstVersion >= "4.10.8.3"
Message=Deinstalling Oracle Java Virtual Machine 1.6 ...
DefVar $UninstallCommand$
DefVar $DisplayName$
DefVar $ExitCode$
 
if FileExists("%ScriptPath%\subdeljava.ins")
	comment "start uninstall"
	sub "%ScriptPath%\subdeljava.ins"
endif
 
[Winbatch_oracle_uninstall]
$UninstallCommand$

subdeljava

Da das updaten der Reg keys mir zu blöd war lass ich jetzt ein Skript danach suchen. Wer befürchtet das dies vielleicht mal zu viel erwischt kann auch die Version von uib verwenden.

; Robert Tauber 2013
 
; RT: Mögliches Zusatz File
;if FileExists("%ScriptPath%\custom_ins_dir\prevent_uninstall.ins")
;	sub "%ScriptPath%\custom_ins_dir\prevent_uninstall.ins"
;endif
 
;RT: Sartmenü Aufreumen
LinkFolder_Webstart_delete
;RT: JAVA Runterschmeisen
Message "Un-Installing (Kann dauern)"
Winbatch_deinstall
Message "Un-Installing Komplet"
;RT: Exit Code Auswerten
Sub_check_exitcode
 
 
 
;RT: Runter mit Java das AutoIt Skript killt alle Java versionen
[Winbatch_deinstall]
%SCRIPTPATH%\Uninstall_Java.exe
 
;RT: Killt den Shot key im Startmenü konte keinen finden
[LinkFolder_Webstart_delete]
set_basefolder common_programs
delete_subfolder "Java"
delete_subfolder "Java Web Start"
 
;RT: Exit cod Checken
[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$ = "1603")
			comment "A fatal error occurred during installation.	1603"
			comment "Quite normal while uninstalling java autoupdater"
			comment "for other uninstalls might be a problem"
	else
 
	  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
endif

Uninstall_Java.exe / Uninstall_Java.au3

SAD (search and destroy) Skript<

#cs ----------------------------------------------------------------------------
 
 AutoIt Version: 3.3.8.1
 Author:         Robert Tauber
 
 Script Function:
	Deinstalirt alle Java Versionen
 
#ce ----------------------------------------------------------------------------
 
; Script Start - Add your code below here
 
DirCreate("c:\temp\")
Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
;Reg Key auslesen
Run(@ComSpec & " /c " & 'start /wait "" REGEDIT /E c:\temp\registry.tmp HKEY_LOCAL_MACHINE\SOFTWARE\microsoft\windows\currentversion\uninstall' ,"", @SW_HIDE)
Run(@ComSpec & " /c " & 'start /wait "" REGEDIT /E c:\temp\registry2.tmp HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\windows\currentversion\uninstall' ,"", @SW_HIDE)
;winwait ("cmd.exe")
 
WinWaitClose ("cmd.exe")
 
;Filter die keys mit {}
Run(@ComSpec & " /c " & 'type c:\temp\registry.tmp | find /i "{" | find /i "}]" > c:\temp\REG.tmp' ,"", @SW_HIDE)
Run(@ComSpec & " /c " & 'type c:\temp\registry2.tmp | find /i "{" | find /i "}]" >> c:\temp\REG.tmp' ,"", @SW_HIDE)
 
 
;winwait ("cmd.exe")
WinWaitClose ("cmd.exe")
 
$file = FileOpen("c:\temp\REG.tmp", 0)
$Java = FileOpen("c:\temp\JAVA_REG.tmp", 2)
;RT: Könte effektiver sein wenn man das ursprüngliche file con key zu key durchsucht
While 1
   Local $line = FileReadLine($file)
   If @error = -1 Then ExitLoop
   $KEY = StringReplace($line, "[", "")
   $KEY = StringReplace($KEY , "]", "")
   ;RT: den inhalt aller {} KEYs Temporär als Text file sichern
   Run(@ComSpec & " /c " & 'start /wait "" REGEDIT /E c:\temp\KEYS.tmp ' & $KEY ,"", @SW_HIDE)
   winwait ("cmd.exe")
   WinWaitClose ("cmd.exe")
   $file_KEY = FileOpen("c:\temp\KEYS.tmp", 0)
   While 1
	  ;RT: Das gerade erstellte textfile nach JER Durchsuchen (JAVA)
	  Local $line_KEY = FileReadLine($file_KEY)
 	  If @error = -1 Then ExitLoop
	  if StringInStr ($line_KEY, "jre") then
		 ;RT: wurde in dem Key eine jre gefunden (JAVA)
		 Local $Split = StringSplit($KEY, "{")
		 $KEY = "{" & $Split[2]
 	  	 ;RT: Schreib die gefundenen keys in das file
		 FileWrite ( $Java , $KEY & @CRLF)
		 ExitLoop
 	  endif
   WEnd
   FileClose ( $file_KEY )
   ;RT: File schlisen da sonst fehler
Wend
FileClose ( $file )
FileClose ( $Java )
 
 
 
;RT: Alle gefundenen Deinstaliren
$Java = FileOpen("c:\temp\JAVA_REG.tmp", 0)
While 1
   Local $line = FileReadLine($Java )
   If @error = -1 Then ExitLoop
   Run(@ComSpec & " /c " & 'MsiExec.exe /qn /X'& $line &' /norestart')
WEnd
;winwait ("cmd.exe")
WinWaitClose ("msiexec")
Sleep(5000)
Winkill ("cmd.exe")
;MsgBox ( 0, "title", "text")