Worklet to remove all java versions

Simple worklet to remove all java versions and write back in activity log. Worklet is maintained on our github page: https://github.com/Dutch-Technology-eXperts/Automox/blob/main/remove_java.ps1

Evaluation code:

Exit 1

Remediation code:

IF (gwmi Win32_Product -filter "name like 'Java%'")
{
[void](gwmi Win32_Product -filter "name like 'Java%'" | % { $_.Uninstall() })

if ($? -eq "True")
{ Write-Output "Java succesfully removed." }
else {Write-Output "Failed to remove Java!" }
}
ELSE {Write-Output "Java not installed."}
2 Likes