Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING Remove all Java till new version was deployed

Sipashka

Member
Messages
6
Reaction score
0
Points
1
Hello, does anybody know how to remove all previous Java version after new version was deployed ?
 
This is gonna be tricky because different java versions have different uninstall string. I would recommend to create report for all installed java versions in your environment and create applications with supersedence configured. This way, irrespective of the installed versions, SCCM will detect which old java version is installed and uninstall it before installing the newer version.

1. Create query-based report
2. Create Applications with detection method (you can do it based on uninstall registry)
3. Create supersedence.
 
This solution helps us.

First package (script)
#Uninstall Software
$app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "Java" -AND $_.Name -ne "Java 8 Update 121"}
foreach ($a in $app) {$a.Uninstall()}

Second package
Install Java 8 Update 121

Use a Task Sequence to deploy the job to clients
First run script
Second install Java 8 Update 121 (only if java 8 update 121 is not installed)


Kind regards
BRB
 
Back
Top