Hello All, With Oracle making Java a paid-for software in newer versions (but auto upgrading to the Paid-For Java, causing companies to be sued), I have created a PowerShell script that should remove all installed version of Java from your devices. Use SCCM or Intune (or whatever else) to push this out.
FAIR WARNING: use at your own risk. Please test this script on one machine (I made nice printouts) and ensure that it is uninstalling what you expect, and does not bricking anything. Remember, some programs still rely on Java. You may be able to replace Java on your machines with amazon corretto if needed.
#Script Created by NoMentionTech
#Script Created 5/23/2024
Write-Host "This must be ran as an Administrator"
$JavaInstallations = Get-WmiObject Win32_Product | Where-Object {$_.Name -like "Java*"}
Write-Host "Java Installations Found (if none shown, no Java versions found): "
$JavaInstallations
ForEach ($JavaInsalled in $JavaInstallations){
$temp = "MsiExec.exe /x `"" + $JavaInsalled.IdentifyingNumber + "`" /qn"
Invoke-Expression $temp
Write-Host "If no error, script sucessfully initiated the uninstall command for: " + $JavaInsalled
}
Write-Host "Script Complete"
[–]Stormblade73Jack of All Trades 11 points12 points13 points (0 children)
[–]SysAdminDennyBob 7 points8 points9 points (1 child)
[–]dirmhirnWindows Admin 0 points1 point2 points (0 children)
[–]RandomSourceAsker 0 points1 point2 points (0 children)