Hallo Zusammen Ich arbeite aktuell an einem Script mit dem ich JAVA auf unseren Clients verteilen kann und dann gegebenenfalls in Zukunft auch wieder sauber updaten kann. Das script funktioniert insofern. Gerne würde ich aber nachdem das *.msi paket installiert wurde nochmals dies validieren und dann inkl. PC Namen in ein Logfile schreiben welches dann auf dem Filer in einem speziellen Ordner zu finden ist. Als Beispiel: PC-XT-001.txt, in dem File sollte man die aktuelle installierte version sehen. Mein Script sieht aktuell so aus:
REM
@echo off
REM next line checks to see if c:\20130114_0930.txt exists. if it does, the rest of the script does not process. this is a simple way to use a run-once script.
if exist "c:\20130114_0930.txt" goto end
REM
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive
wmic product where "name like 'JavaFX%%'" call uninstall /nointeractive
wmic product where "name like 'Java(TM) 7%%'" call uninstall /nointeractive
wmic product where "name like 'Java(tm) 6%%'" call uninstall /nointeractive
wmic product where "name like 'J2SE Runtime Environment%%'" call uninstall /nointeractive
REM
REM CHECK IF already a MSI Installer is Working at the moment
:startMSICheck
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\InProgress" > nul 2>&1
if %ERRORLEVEL% equ 0 (
echo MSI is currently running!
echo Sleeping for 1 second...
ping -n 1 -l 0 localhost > nul 2>&1
goto startMSICheck
) else (echo MSI is not currently running, returning.)
REM Starting with the installation of JAVA
msiexec /i "\\192.168.0.25\public\java\jre1.7.0_17.msi" /quiet
REM Ensure that JAVA is installed and write a log
REM create the c:\20130114_0930.txt file to ensure above-command does not run again.
echo 20130114_0930 older java 7 uninstalled. > c:\20130114_0930.txt
echo Do NOT delete this file as it will cause Java to uninstall on next 'gpupdate'. >> c:\20130114_0930.txt
attrib +h c:\20130114_0930.txt
:end
exit
Den oben erwähnten Check würde ich gerne nach der Installation ausführen (ENSURE that JAVA is installed and write a log)
Könnte mir jemand von euch Script Profis hier weiterhelfen wie ich das noch sicherstellen kann.
Im Voraus besten Dank für eure Unterstützung
Mario