Deploy Java Runtime Environment as SCCM application using PSADT

This guide will show you how to deploy Java Runtime Environment (both 32- and 64-bit) via SCCM with user interaction using PSADT. The app will do the following:

  • Prompt user to close Java apps
  • Uninstall previous JRE(s)
  • Install both 32- and 64-bit JRE
  • Disable update notifications

Get the files

Get latest offline executable JRE installers, as well as latest PSADT (3.70 as of writing). Also, get ServiceUI.exe (32-bit) from MDT if your SCCM version is less than 1802.
Copy both installers to the PSADT Files directory. Next, let’s modify Deploy-Application.ps1.

Install Script

Variable declaration
Let’s start by declaring some global variables. Specifically check that $appVersion is current. In general take model of following:

Pre-installation

Pretty straightforward. If user is running java app, allow closing of app, or deferral. Also show installation progress.
As part of the installation, we remove previous versions of Java.

Install

In the install phase, let’s set install parameters to e.g. disable Java auto-updates.
Lastly, for all .exe installers in the Files directory, execute them. This shall install both 32-bit and 64-bit Java.

Post-install

Not much here. If Java was running in the beginning, show a prompt to user to inform of successful update.

Uninstall

Basically copy the pre-install commands, i.e. Show-InstallationWelcome,Show-InstallationProgress and Remove-MSIApplications.

Application in SCCM

For SCCM => 1802:
Create application as you normally do. For deployment type, select Script Installer.
For installation program command, use Deploy-Application.exe.
For uninstallation program command, use Deploy-Application.exe Uninstall.
For User Experience, choose “Whether user logged on or not” and check “Allow users to view and interact”.

For SCCM < 1802:

Create application as you normally do. For deployment type, select Script Installer.
For installation program command, use ServiceUI.exe Deploy-Application.exe.
For uninstallation program command, use ServiceUI.exe Deploy-Application.exe Uninstall.
Lastly, check to run in 32-bit. For User Experience, choose “Whether user logged on or not”.

Detection method

Use the following for detection method, please check that you have correct version declared.

That’s it.

Leave a Reply

Your email address will not be published. Required fields are marked *