Skip to main content

For powershell experts: I’m trying to customize the Java worklet in the catalog to install Java to non-default custom path. Using Argument-list INSTALLDIR seems to be erroring out. Anyone has the correct syntax to use in the Remediation script (Start-Process) 

Start-Process "$env:windir\Temp\$javaInstallFile" -ArgumentList "/s REBOOT=0 SPONSORS=0" -Wait

What can I add to the above line so Java gets installed in path D:\Java ?? Thanks!

Hi Naseem,

 

Thanks for reaching out in the Automox Community!

To install Java to a specific directory, you’ll want to include the INSTALLDIR argument to your code:

Source: https://www.java.com/en/download/help/silent_install.html

 

If you are using our Catalog Worklet for installing Java, you will want to replace line 114 in the Remediation Code block with the following:

Start-Process "$env:windir\Temp\$javaInstallFile" -ArgumentList "/s INSTALLDIR=D:\java\jre REBOOT=0 SPONSORS=0" -Wait

 

This will install Java to the D:\java\jre directory.  You can of course change this directory or destination folder to whatever you’d like.  Just be sure to update the INSTALLDIR argument accordingly, where your full UNC path is listed after INSTALLDIR=

 

As a side note, be sure to upload your Java Install exe to the Payload portion of the worklet if you haven’t already, as this is the file that is called within the $javaInstallFile variable above:

 

 

I hope this helps!

 

Let me know if you have any questions or issues!


Reply