Share via


Windows 7 or higher: Deploying Java 8 Update 40/45 with System Account

Here is Batch file for Java x86 (32-bit) .exe File Installation on Windows 7 or higher x64 OS with changing System Account Profile Value in Registry:

jre_x86.bat

@echo off
REM *******************************************************************************
REM * Name: jre_x86.bat *
REM * jre-8u45-windows-i586.exe Version for Windows 7 or higher (x64 OS) *
REM * You can find Java default Logs in %Systemroot%\Temp Folder, 2x Files (jusched.LOG & JavaDeployReg.LOG) *
REM * EXE Installation Log File Name is jre8u45_32.log *
REM * You must disable AutoUpdate in Registry (EXE Parameter doesnot Work ) *
REM *******************************************************************************

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-18" /v ProfileImagePath /t REG_EXPAND_SZ /d %systemroot%\sysWOW64\config\systemprofile /f

IF NOT EXIST "%ALLUSERSPROFILE%\Oracle\Java" MKDIR "%ALLUSERSPROFILE%\Oracle\Java"
echo.>"%ALLUSERSPROFILE%\Oracle\Java\java.settings.cfg"

jre-8u45-windows-i586.exe /s AUTO_UPDATE=0 OEMUPDATE=0 WEB_JAVA_SECURITY_LEVEL=H INSTALL_SILENT=1 STATIC=0 INSTALLDIR="%programfiles(x86)%\java\jre8u45_32" REBOOT=0 SPONSORS=0 EULA=0 WEB_ANALYTICS=0 /Lv* "C:\JAVA_Install\jre8u45_32.log"

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-18" /v ProfileImagePath /t REG_EXPAND_SZ /d %systemroot%\system32\config\systemprofile /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /f /v "EnableJavaUpdate" /t REG_DWORD /d "0"

Here is Batch file for Java x86 (32-bit) .exe File Installation on Windows 7 or higher x64 OS without changing System Account Profile Value in Registry:

jre_x86.bat

@echo off
REM *******************************************************************************
REM * Name: jre_x86.bat *     
REM * jre-8u45-windows-i586.exe Version for Windows 7 or higher (x64 OS) *
REM * In C:\Install\Java is jre-8u45-windows-i586.exe File and C:\ drive is %SystemDrive% *
REM * You can find Java default Logs in %Systemroot%\Temp Folder, 2x Files (jusched.LOG & JavaDeployReg.LOG) *
REM * EXE Installation Log File Name is jre8u45_32.log *
REM * You must disable AutoUpdate in Registry (EXE Parameter doesnot Work ) *
REM *******************************************************************************

echo y | rmdir /s "%SystemRoot%\SysWOW64\config\systemprofile\AppData\LocalLow\sun"
echo y | rmdir /s "%SystemRoot%\System32\config\systemprofile\AppData\LocalLow\sun"

mkdir "%SystemRoot%\SysWOW64\config\systemprofile\AppData\LocalLow\sun"

start /WAIT powershell.exe -noprofile -c "&{$l='C:\Windows\SysWOW64\config\systemprofile\AppData\LocalLow';$l32 = $l.replace('WOW64','tem32');$dir=gci $l -force | Where {$_.name -eq 'sun'};if((gwmi Win32_OperatingSystem).OSArchitecture -eq '64-bit' -and !(($dir.Attributes) -match 'ReparsePoint')){gci $l\Sun -Recurse | rm -recurse -force; rm $l\Sun -recurse -force;mkdir $l32\Sun;cmd /cmklink /J $l\Sun $l32\Sun|out-null;};New-Item -Force -ItemType File -Path $env:allusersprofile\Oracle\Java\java.settings.cfg -Value "AUTO_UPDATE=0`r`nEULA=0`r`nOEMUPDATE=0`r`nINSTALL_SILENT=1`r`nSPONSORS=0`r`nWEB_ANALYTICS=0`r`nINSTALLDIR=${env:ProgramFiles(x86)}\Java\jre8u45_32";%SystemDrive%\Install\Java\jre-8u45-windows-i586.exe /s AUTO_UPDATE=0 EULA=0 OEMUPDATE=0 INSTALLDIR="${env:ProgramFiles(x86)}\Java\jre8u45_32" INSTALL_SILENT=1 REBOOT=0 SPONSORS=0 WEB_ANALYTICS=0 /Lv* jre8u45_32.log | out-null;$host.SetShouldExit($LastExitCode);}"

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /f /v "EnableJavaUpdate" /t REG_DWORD /d "0"