JreBlock: Script for hiding native Java

Photo: Patrick Mangan

Originally by: Patrick Mangan

Updated by: Tim Mangan for version 3.0

JreBlock: is a simple PowerShell script to help when you need to sequence a Java JRE inside of an App-V virtual environment and want to block visibility to other Java versions that might be natively installed at the client.

The typical technique to sequencing Java JREs is to actively attempt to hide all other versions of Java from the virtual environment other than the one you want. Arron Parker provided a cmd script back in the App-V 4.5 days, but it needs to be updated to the latest versions of Java to use it.

This is a PowerShell script that anticipates the likely versions of Java over the next few years, and allows you to optionally specify a maximum version if that isn’t enough.

To use the script using the default settings, which handle up to version 1.9.2.99, you would run the following commands in a 32-bit powershell window [meaning that on an x64 OS you must use powershell (x86) ] that is launched using RunAdAdministrator.

  • Before sequencing:
    • Set-ExecutionPolicy  -ExecutionPolicy Bypass
    • cd [folder with ps1 file]
    • .\ jreBlock.ps1 $true”
  • While Monitoring:
    • Set-ExecutionPolicy  -ExecutionPolicy Bypass
    • cd [folder with ps1 file]
    • .\jreBlock.ps1 $false”
    • and then install the JRE that you need
    • and then remember to turn off autoupdates to Java.

It will create a few more blocker keys than you need, but better safe then sorry.

In version 3.0, it creates keys for:

  • all known existing versions up to 1.8 u111
  • a few extra versions in case someone ever patches an old version
  • future keys up to 1.80 u199
  • future keys for 1.9.0 through 1.9.2 u 99

You can always modify the script yourself if you want more versions blocked.

The tool is free for personal or commercial use.

Article with more info in Tools section.

Direct download for ZIP with the PS1 file: jreBlock V 3.0.0.0


Patrick Mangan was a consultant at TMurgent Technologies when he wrote the original version.  He now specializes in sequencing difficult packages at Northeastern University.

By Tim Mangan

Tim is a Microsoft MVP, and a Citrix CTP Fellow. He is an expert in App-V and MSIX.