Silent Java update check

5

4

How to have automatic Java updates without jusched.exe process running all the time in the background and with control when a check for the update should occur?

rik

Posted 2012-07-01T18:46:46.780

Reputation: 320

I'm not 100% sure I understand what's being asked here – Stevoisiak – 2017-06-04T00:12:14.640

Answers

7

Assumptions:

  • Windows 7 64-bit
  • Java 32-bit

Disable Java Automatic Updates: Change Java Update options.


Create java_check_update.ps1 PowerShell script with following content:

$currVer = Get-ItemProperty "hklm:\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" -name "CurrentVersion"

if (!$currVer.'CurrentVersion') {
    Exit
}

$famVerStr = ('Java' + $currVer.'CurrentVersion'.Split(".")[1] + 'FamilyVersion')
$famVer = Get-ItemProperty "hklm:\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" -name $famVerStr

if (!$famVer.$famVerStr) {
    Exit
}

$java_version = $famVer.$famVerStr

$url = "http://javadl-esd.sun.com/update/" + $currVer.'CurrentVersion' + ".0/map-" + $currVer.'CurrentVersion' + ".0.xml"

$c = New-Object System.Net.WebClient
$xml = $c.DownloadString($url)

$p = [xml]$xml
$n = $p.SelectSingleNode('java-update-map/mapping[version="' + $java_version + '"]')

if ($n) {
    #update available
    cmd.exe /c "C:\Program Files (x86)\Common Files\Java\Java Update\jucheck.exe"
}

Create java_check_update.vbs VBScript with following content:

Set oShell = CreateObject("WScript.Shell")
oShell.Run "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File ""PATH_TO_POWERSHELL_SCRIPT""", 0

PATH_TO_POWERSHELL_SCRIPT for example: D:\Scripts\java_check_update.ps1


Add new task in Task Scheduler to run script java_check_update.vbs (full path to file) every day, week or month.

rik

Posted 2012-07-01T18:46:46.780

Reputation: 320

0

You can also use this program auto java updater. Schedule it and let it run in the background and it will do everything automaticly.

droidgren

Posted 2012-07-01T18:46:46.780

Reputation: 564