Reputation: 860
Windows powershell command to uninstall all versions of Java except a specific version. This command should work in windows 7 & above.
The following command uninstalls all versions. How do I modify the following in such a way that a specific version 8.0.770.3 does not uninstall.
gwmi Win32_Product -filter "name like 'Java%' AND vendor like 'Oracle%' AND (version like '[78].%' OR version like '1.[78].%')" | % { $_.Uninstall() }
Upvotes: 0
Views: 25466
Reputation: 11
simplest powershell script
gwmi Win32_Product -filter "name like 'Java%'" | % { $_.Uninstall() }
Upvotes: 0
Reputation: 1963
Change the filtering of version.
gwmi Win32_Product -filter "name like 'Java%' AND vendor like 'Oracle%' AND
not version = '8.0.770.3'" | % { $_.Uninstall() }
Upvotes: 1