Worklet to remove all java versions

  • 17 November 2020
  • 0 replies
  • 128 views

Userlevel 4
Badge

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."}

0 replies

Be the first to reply!

Reply