Worklet - Java 271

Hey guys, just need some assistance finalising the Java worklet. The automatic patching seems to have uninstalled Java from a fair few machines so need to resolve.

It works fine running from the local machine, however no luck from Automox.

Eval is fine.
It downloads the two files then does not run the commands; installing 2 instances of Java (32 and 64bit).

#Handle Exit Codes:
trap { $host.ui.WriteErrorLine($_.Exception); exit 90 }


    $process1 = Start-Process -FilePath 'jre-8u271-windows-i586.exe' -ArgumentList '/s', 'REMOVEOUTOFDATEJRES=1', '/L C:\ProgramData\amagent\worklets\java\java_86.log' -Wait -Passthru -ErrorAction Stop
    $process2 = Start-Process -FilePath 'jre-8u271-windows-x64.exe' -ArgumentList '/s', '/L C:\ProgramData\amagent\worklets\java\java_64.log' -Wait -Passthru -ErrorAction Stop
    exit 0



    $Exception = $error[0].Exception.Message + "`nAt Line " + $error[0].InvocationInfo.ScriptLineNumber
    Write-Output $Exception
    exit 90

Would appreciate any assistance.

Hey there. I haven’t installed JRE in quite a while. With that being said, it looks like there are now 2 installers (exe and msi), and each has a method to define configurations.
EXE appears to prefer a configuration file:
MSI supports additional switches and/or a config file:

As an Automox best practice, I would suggest using an alternate directory for your log file. the amagent directory is the running directory for the Automox agent, and content may not persist through agent actions, or upgrades. There will be cases where this directory permissions are reset by the agent as well.