Jump to content
Sign in to follow this  
ethorup

Script to download and silent install Java Runtime

Recommended Posts

This script will download the small online installer, generate the silent install cfg file and run the installer.  The timer near the end is set for 3 minutes as it has to download the full installer first and Java takes a while to install anyway.  If you want to get the latest version just go to https://java.com/en/download/win10.jsp and copy the link from the button that says "Agree and start free download".  Then past this link into the $source variable.  I find that this installer works on both windows 7 and windows 10.

 

# Download and silent install Java Runtime Environement

# working directory path
$workd = "c:\temp"

# Check if work directory exists if not create it
If (!(Test-Path -Path $workd -PathType Container))

New-Item -Path $workd  -ItemType directory 
}

#create config file for silent install
$text = '
INSTALL_SILENT=Enable
AUTO_UPDATE=Enable
SPONSORS=Disable
REMOVEOUTOFDATEJRES=1
'
$text | Set-Content "$workd\jreinstall.cfg"
    
#download executable, this is the small online installer
$source = "http://javadl.oracle.com/webapps/download/AutoDL?BundleId=230511_2f38c3b165be4555a1fa6e98c45e0808"
$destination = "$workd\jreInstall.exe"
$client = New-Object System.Net.WebClient
$client.DownloadFile($source, $destination)

#install silently
Start-Process -FilePath "$workd\jreInstall.exe" -ArgumentList INSTALLCFG="$workd\jreinstall.cfg"

# Wait 120 Seconds for the installation to finish
Start-Sleep -s 180

# Remove the installer
rm -Force $workd\jre*

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • By MrBuzz2u
      I am looking for a way to track windows user logins/logouts...but many users only lock/unlock their desktop rather than log out.  Any other way to track this and receive notifications?  If notifications are not possible, how about a report that would gather this info?  Hoping to do this through Pulseway, but open to other options/apps as well.   Any help would be greatly appreciated.
    • By MakoLogics
      Hello I keep getting a ton of alerts daily for Windows Defender, they show up as important updates. I run the Web Root AV on all my clients so I would love a script to disable Windows Defender on all machines. It would take for ever to do hundreds of machines manually.
       
      Thank you.
    • By MakoLogics
      Is there a way to change settings in each of the desktop clients via the web?
      See image below for example.
       
       

    • By itshero
      I am having trouble connecting to workstations via the dashboard, as well as the remote desktop application.  Getting error "The agent failed to start the rd session."
    • By cesarius
      Hello,
      since some days my hard disk drives don't spin down anymore while not in use. I tracked the problem down with process monitor and found out that the PCMonitor Service is accessing the drives every minute through the WMI Provider Host Service (wmiprvse.exe).
      I disabled in Pulseway the storage notification of local disk space on all drives but it did not help.
      As soon as I disable the Puleway service, the disks spin down after the configured laps of time as they should do.
      I'am using Pulseway since some years, but the problem occured recently and was not there before.
      Thanks for your help.
      Michael
       
×