Java Auto Updater

This script is for automatically updating, deploying or removing Java (JRE). The default options at the top will both download and update JRE to the latest public release. 

4.5 Star
6,606 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • install or update java without reboot
    1 Posts | Last post July 27, 2017
    • Hi,
      I have try to add a file configuration of java for disable reboot but they do nothing do not install and do not update. 
      Here is my file configuration C:\java\jre.cfg :
      and here is the parameter : 
      JRE_Updater.vbs /x86:2 /x64:2 /Logging:1 /FileStore:"C:\java" /switches32:"/s INSTALLCFG=C:\java\jre.cfg" /switches64:"/s INSTALLCFG=C:\java\jre.cfg" 
      without INSTALLCFG=C:\java\jre.cfg works perfectly.
      Can you help me please.
      Thanks in advance.
  • Downloads but doesn't install.
    2 Posts | Last post April 20, 2017
    • After i double click on the script it creates a download file and downloads jre32 and jre64...but they never install.  Any ideas?
    • Hi Jmmitche,
      Do you already have Java installed?  The default option for the script is to only update existing versions found.   
      If you want to deploy Java when it's not installed, use the /x86:2 and /x64:2 options.
      The opposite is true if you want to uninstall Java rather than update, /x86:0 /x64:0
      Let me know if that answers your question or if there is some other issue.
  • When I run the script , it appears error in line 69
    8 Posts | Last post March 30, 2017
    • Hello Kevin , 
      When i run the script , it appears the next error " Error in line 69 , caracter 2 "  can you help me ? 
      Best regards Light
    • I could fix this , but now when i execute the script appear this error :
      "C:\Users\X\Downloads\JRE_Updater.vbs(111, 4) Msi API Error: ProductInfor,Porduct,Attribute" 
      Thanks for all.
      Best Regards Light
    • Hi Jordi,
      Thanks for bringing this to my attention.
      The trouble originated at line 62 which declared the User-Agent in the request header.  For whatever reason Java's site stopped responding properly to this header.  
      I've shorted the User-Agent from: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36" 
      To just this: "Mozilla/5.0 (Windows NT 6.1; WOW64)"
      The HTTP request appears to be responding properly again (this needs to be parsed to get the JRE download URLs).
      Please try downloading the updated script and seeing if it works in your environment.  I've also added a line to remove errors at line 27, "On Error Resume Next".  If the script is still not working for you please remove that and message me with the error.  
      Thanks again for the heads up on the script error.
    • Hello Kevin ,
      The script works perfectly, thank you very much. But now I'm trying to create a GPO to use this script users without admin rights . You know how I do it?
      Thanks for all Kevin , u are a master !
      Best Regards Jordi
    • Good to hear it's working for you.  Unfortunately, I'm afraid the script as it currently exists requires admin rights to install, as does Java itself.  
      The best you could get is for the script to run without admin rights but then the user would get a UAC prompt to elevate whenever Java needs to reinstall.
      This would be bad practice in most environments though, since the script runs silently users would get seemingly random UAC prompts.  Never a good idea to accustom users to clicking random UAC prompts.
    • Kevin thank you very much, I will try to find a way to install your script users without administrator permission.
      Thanks for your advice friend.
      If I find something, I will keep you informed 
      Best Regards Jordi :) PD: your script is awesome 
    • Thank you for the script Kevin, works perfectly. 
      @Jordi, same issue here on Windows 8.1 with UAC enabled.
      I'm going to try deploy the script with a scheduled task using the Local System account.
      Best Regards,
    • Some solution to GPO with users without admin rights?
      I have the same problem
  • Update function
    2 Posts | Last post November 04, 2016
    • Great script, been using it awhile.
      Feature Request:  When performing an update only function, could you please include an option to install x64 if x32 is found and if the OS is x64?
      Reason:  We don't deploy Java to everyone, only those who need it.  So we only autorun your script in "update only" mode, so it doesn't get deployed to everyone.  That said, our techs tend to manually deploy Java as opposed to using a script, and often forget to deploy both x64 and x32 when the system is an x64 system, even though we have some x64 programs using Java x64.   
    • Hi Xeiran,
      Feature request has been implemented.  Please take a look at the update notes at the bottom of the script description on Technet to confirm I understood your request correctly.  If so, the new feature can be used with option /x64:3 or editing the script so variable x64 = 3 on line 16.
      Assuming I understood you correctly, can you please test this in your environment and confirm it's working as expected.   
      By the way, great recommendation.   The same option can  be used by admins looking to purge a JRE type and then replace it with the appropriate bitness using something like /x86:0 /x64:3 or /x64:3 /x86:0
      Let me know if you think of any other useful features.
  • Two Things
    2 Posts | Last post October 20, 2016
    • Hi There, first of all, thanks for the script; It's been very useful. Just two things, it's stopped working for me. First of all I was getting "Access denied" on the server downloading the JRE, this was resolved by changing:
      The server now downloads the files but unfortunately the clients won't install. The script runs briefly and then exits. In the logs I get:
      20/10/2016 15:45:23 Download_Check SUCCESS Download not set to 1, skipping query/download stage
      20/10/2016 15:45:23 Modify_Check SUCCESS ModifyJRE set to 1, Confirming files and examining installed versions for removal
      20/10/2016 15:45:24 Confirm_x86_File SUCCESS x86 file found, version=8.0.1110.14
      20/10/2016 15:45:24 Confirm_x64_File SUCCESS x64 file found, version=8.0.1110.14
      20/10/2016 15:45:24 Removal_Complete SUCCESS 
      I currently have version 101 installed. I'm calling this through the task scheduler using an admin account and the below command:
      \\Servername\script$\Java\JRE_Updater.vbs /Download:0 /Logging:1 /FileStore:"\\Servername\script$\Java\Installer\"
      Are you able to advise?
    • Hi Cam,
      I released a new update over the weekend which addressed the first issue, and the description of that one is in the release notes at the bottom of the Technet page.  The second issue you brought up is entirely new, and is cause by the release version becoming three digits in length rather than two.  I've just modified the script to handle this eventuality and it's now available on the Technet page.
      For some boring detail if you're interested: the script uses the product GUID to identify installed JRE versions for comparison, and that GUID has been completely consistent across JRE versions 6, 7 & 8.   In the GUID starting at character position 29 is where the script detects the bitness (32 or 64).   The release version of JRE is also described in the GUID toward the end and when the version became three digits, it "pushed" the bitness section of the GUID up by 1 character position.  I simply modified the script to change how it's looking for the bitness from something like this:
                  If Mid(product,29,2) = "32" Then
                  If InStr(Mid(product,28,3), "32") Then
      This will look for the string 32 anywhere in the 3 digits starting at position 28, so will capture both potential locations.  
  • Working Script
    2 Posts | Last post June 16, 2016
    • I keep getting an error at line 34 and think I am doing something wrong.  I try to run script as is but I am still receiving the same error.  Could someone post a working script version so I could see kind of what I am missing.
    • Hi Wave,
      I'm guessing you may have tried to just copy/paste the sample segment showing on the website into a .vbs file.
      That segment is just to go over the options/switches available.  The actual script is about x10 longer so you'll want to download the .vbs file from the Download link on the site.
      Let me know if you have any trouble after that, or please correct me if I made a mistaken assumption about the nature of the error.
  • Proxy settings & run as administrator
    1 Posts | Last post April 05, 2016
    • Just want to mention that this is an awesome script!
      Thank you for sharing!
      I've added two things for my setup:
      1. at the beginning I added this code because the default user doesn't have the necessary access right:
      2. at the beginning of the getBundle function I set the network proxy:
          objXMLHTTP.setProxy 2, "<<ip>>:<<port>>", ""
  • Parse response error
    2 Posts | Last post March 30, 2016
    • Hi Kevin,
      I am getting error after executing the script locally. Below are the logs:
      3/30/2016 6:07:24 AM Download_Check SUCCESS Download set to 1, attempting to query Java and download latest bundle
      3/30/2016 6:07:24 AM Verify_DownloadLog SUCCESS C:\Users\502220749\Downloads\Download.log does not exist, attempting to create it...
      3/30/2016 6:07:24 AM Create_DownloadLog SUCCESS Created DownloadLog: C:\Users\502220749\Downloads\Download.log
      3/30/2016 6:07:24 AM Read_DownloadLog SUCCESS 
      3/30/2016 6:07:24 AM Sending_Request SUCCESS 
      3/30/2016 6:07:24 AM Parse_Response SUCCESS BundleURL=
      3/30/2016 6:07:24 AM Verify_URL SUCCESS Bundle URL not found in Download.log, adding to log, attempting download...
      3/30/2016 6:07:24 AM Parse_Response ERROR The server name or address could not be resolved
      3/30/2016 6:07:24 AM Verify_URL SUCCESS Bundle URL not found in Download.log, adding to log, attempting download...
      3/30/2016 6:07:24 AM Modify_Check ERROR The server name or address could not be resolved
      3/30/2016 6:07:24 AM Confirm_x86_File SUCCESS x86 file not found, skipping install, only checking for removal setting compare version to
      3/30/2016 6:07:24 AM Confirm_x64_File SUCCESS x64 file not found, skipping install, only checking for removal setting compare version to
      3/30/2016 6:07:24 AM Removal_Complete SUCCESS 
      Please let me know if any change is required in the script.
      Mohd Wasi
    • Hi Mohd,
      Could you confirm what arguments you're passing?  When you have a moment could you try to delete any existing logs or move the script to an empty directory and trying running it without any arguments?  
      From the log you posted it looks like your system is querying Oracle, it gets the download URL but for some reason the system is not resolving this address properly:
      That does seem like very strange behavior, are you able to bring that same URL in a browser?  If successful in a browser it should just start downloading the Java executable.  
      Let me know what you find out.
  • avast flags this as virus
    2 Posts | Last post March 18, 2016
    • how to tell if legit?
    • Thanks for bringing this to my attention.  This has happened once before so I'll have to send them notification about the false positive.  
      As for whether it is legit, the code isn't compiled or obfuscated in any way.  If you read VBS or know someone who does, they can tell you the only website calls it makes are to, so unless they're serving up viruses now, you don't have anything to worry about.  
      Microsoft has hosted this script for over two years and despite updates, the fundamental functions haven't changed.  I'm sure if there were even a hint that it was malicious, Microsoft would immediately pull it.  
  • Forcing deployment of pre-downloaded JRE
    7 Posts | Last post November 23, 2015
    • Hi Kevin,
      I've been using the script to deploy Java to our Windows servers for a few months now, and it has worked great, but I ran into an issue a few days ago. I had already deployed Java8-U65 to our test servers and was ready to deploy to production, but in the few days we had been testing, U66 had been released. Even though my pre-downloaded file was U65 and the switch in the script was set to "Download=0", the script still retrieved and installed U66. In that situation, even though U66 is the latest version, I can't deploy it until it's been fully tested. Since U65 had already been tested, I wanted to go ahead and deploy it to production, but had no luck trying to figure out how to get the script to make that happen. It seems that either I'm misinterpreting the meaning of the Download switch, or something is going haywire in execution. 
    • Hey Mike,
      I'm having trouble replicating the issue you described.  When I set the Download switch to 0, all the code from Line 47 to Line 105 is skipped entirely. This is the only portion of the script that can query Oracle's servers or download data.  With Download=0 it should go right to examining your installed versions.
      I'm happy to assist trying to figure out what might be going if you'd like, but if all you're attempting to do is get the script working with a previous version of Java that should be pretty easy.  In the script's directory you very likely have a JRE_Bundle.log file, that will contain the download URL for each version of Java the script has ever queried from Oracle.  Just download the second to last URL in that list, which should be the most recent previous version.  Alternatively, you can download them from these URL's for JREu65:
      x64 =
      x86 =
      Next step is changing the downloaded files to the generic names the script uses:
      With these renamed files sitting in the same directory as the script it should install only u65 with these settings:
      modify=1 (to update)
      modify=2 (to deploy)
      If you're interested in trying to figure out if/why the script is downloading when it shouldn't be let me know.  The first test would be to stick a wscript.echo("Test") at line 48, just below "If Download = 1 Then", then set download = 0 and run the script.  If you actually get that Test popup then there is a very strange issue indeed, please let me know your results.
      If you have the file being downloaded by a central server and having other hosts pulling data from a share then that may be another thing worth examining, let me know what kind of setup you have or if you'd like some more help.
    • Thanks Kevin. I think the original problem was that after I changed the value of the Download switch to 0, I didn't delete JRE_32bitBrowsers.exe and JRE_64bitBrowsers.exe and re-create them with U65. Unfortunately, now that I've been changing stuff around troubleshooting, the script isn't working correctly as it did previously. I have to be out of the office this afternoon, will try to figure out what's going wrong tomorrow. Will post back here if I can't get it working.
    • It seems that something about the install/uninstall/reinstall process has broken the script. Uninstalls still work, both explicitly or at the front end of the install process, but when it gets to the install part nothing happens and it goes straight back to the command prompt. To make sure I hadn't introduced a typo to the existing script, I downloaded a fresh copy, but that made no difference. I can manually install JRE's (without using the script) with no problem, but the script isn't working, whether  it's an upgrade, or an install after a manual uninstall. Nothing in the Windows event logs appears to offer any clues. My guess is there's something in the registry that's changed from what the script is looking for, but I'm not sure  how to track it down. 
      For background, we're using this script along with a deployment tool (PDQ Deploy) to distribute the JRE upgrades to sets of servers. For troubleshooting purposes, though, I'm executing the script on the server I'm trying to install it to, just to take the deployment tool completely out of the equation. 
    • Hi Mike,
      My apologies, in my last reply I suggested setting modify=1 or modify=2 to deploy, what you actually want is modify=1 and x86=1 (or 2 to deploy) and x64=1 (or 2 to deploy). 
      Setting modify=2 would definitely cause the install part of the script to fail and that was my mistake.
      I just tested updating a server from u50 to u65 using the settings below and ran into no issues.  If you're still running into issues after correcting those settings please remove or comment out the line which reads "On Error Resume Next", then let me know what error you're encountering.  
      'Download=0 if this is a client that is 'not' downloading 
      'ModifyJRE=0 if this is a host that is 'only' downloading 
      'Location for downloaded files.  Example: FileStore="\\Server\SharedFolder\" 
      'Leaving FileStore as "" uses the script's working directory 
      '0 = Remove JRE, 1 = Update Existing JRE, 2 = Deploy and/or Update JRE 
      x64=1 'For x64 bit browsers otherwise use only x86 for x64 systems 
    • OK, it looks like it's back working. The problem was it needed the trailing slash in the FileStore path. Thanks for the quick responses - much appreciated! 
    • Great to hear that it's working again.  I've always worried that trailing slash might be trouble, perhaps when I next update the script I'll create a function to verify and append a slash if needed.  Let me know if you run into any more issues.
1 - 10 of 12 Items