Scripted Silent Install of Java from a Share

With all the news and reports of Zero Day Java exploits, you will want to keep Java updated; if you really need it.  If you don't need it, quit reading this and uninstall immediately.  That being said, read on for silent install instructions from a share.

Previously, I had just been downloading the executable installer from java.com and appending a /s for silent install and life was good.  With the latest version of Java, JRE7U11, this method quit working and my scripts would just hang in the background.

***For troubleshooting purposed, you can launch the jresetup.exe from the commandline with the /L C:\PathToLogFile option like so

\\server\share$\jresetup.exe /s /L %systemdrive%\itlogs\jresetuplog7U11.txt

From this log I was able to garner that there are two files that should be extracted from the executable:

jre1.7.0_11.msi
Data1.cab

These files SHOULD be extracted from the executable to the following location:

C:\Users\UserScriptRunsAs\AppData\LocalLow\Sun\Java\jre1.7.0_11\

This wasn't happening when launching the install from a shared network drive so I came up with the following solution for my script:


#First, check and skip if this process has run before

if exist %systemdrive%\ITlogs\jresetuplog7U11.txt goto end     

 #Make the local directory
mkdir %systemdrive%\Users\UserScriptRunsAs\AppData\LocalLow\Sun\Java\jre1.7.0_11  

#Copy the files to the local directory directory
copy \\server.company.com\software$\jredeploy\jre\*.* %systemdrive%\Users\UserScriptRunsAs\AppData\LocalLow\Sun\Java\jre1.7.0_11\   

#Launch the install and all should be well
\\server.company.com\software$\jredeploy\jresetup.exe /s /L %systemdrive%\ITlogs\jresetuplog7U11.txt

:end
exit


You will, of course, have to initially launch the executable on a machine (leave the installer open but don't actually start the install) and browse to the
C:\Users\UserScriptRunsAs\AppData\LocalLow\Sun\Java\jre1.7.0_11\
directory and grab the jre1.7.0_11.msi and Data1.cab files.  Upon doing so, they will need to exist in a jre folder on the same share as shown above; \\server.company.com\software$\jredeploy\jre\

Comments

Popular Posts