[wpkg-users] Removing old Java versions & WMI/registry tricks [was Use regex to get installed version number?]
Will Aoki
waoki at umnh.utah.edu
Mon Apr 13 23:06:27 CEST 2015
On Thu, Apr 09, 2015 at 06:20:55PM -0600, Will Aoki wrote:
> I haven't integrated into the package yet, but I plan to do it tomorrow.
> Until then, here's what I'm doing:
Here are better ways to do it. These (a) use %shortupdatever% from the
package definition, (b) block until msiexec is done and (c) work even
when Oracle decided that the UninstallString should do "msiexec /i".
[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes({
foreach ($i in get-itemproperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
where-object {$_.displayname -like "Java 8*" } |
where-object {$_.displayname -notlike "Java 8 Update $env:shortupdatever*"} ) {
msiexec /x $i.PSChildName.ToString() /qn | write-output
}}))
[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes({
foreach ($i in get-itemproperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |
where-object {$_.displayname -like "Java 8*" } |
where-object {$_.displayname -notlike "Java 8 Update $env:shortupdatever*"} ) {
msiexec /x $i.PSChildName.ToString() /qn | write-output
}}))
More information about the wpkg-users
mailing list