Check if java is installed and running

  • 4 November 2020
  • 1 reply

Userlevel 4

Since the beginning of time we see java being installed by default. With the changing license structure of Oracle and the monthly increase in java vulnerabilities it is time to reduce the java footprint to the bare minimum.

this worklet does a simple check if Oracle Java or Amazon Corretto is installed and if so checks if there is a running JAVA process to help determine if JAVA is needed on that system or if it can be removed.

Evaluation Code


Remediation Code

$installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -Match "Java" -or $_.DisplayName -match "Corretto" })
$version = "(Vendor: " + $installed.Publisher + " " + "Version: " + $installed.DisplayName + ")"

If(-Not $installed) {
Write-Output "Java is not installed"
} else {
IF (Get-Process -Name "java" -ErrorAction SilentlyContinue) {
Write-Output "$version is installed and currently running."
else {
Write-Output "$version installed but not being used at the moment."

Version management is handled on our github page;

1 reply

What a great idea!