Skip to content

Instantly share code, notes, and snippets.

@lumodino
Created May 11, 2020 09:30
Show Gist options
  • Save lumodino/b9cc1761a6677cc97975e2245cf765e7 to your computer and use it in GitHub Desktop.
Save lumodino/b9cc1761a6677cc97975e2245cf765e7 to your computer and use it in GitHub Desktop.
<#
.Synopsis
Desinstalación de todas las versiones de Java JDK
.DESCRIPTION
Busca todas las versiones de Java JDK instaladas por medio de una expresión regular para localizar el identificador del instalador MSI y quita todas las versiones encontradas.
#>
function Remove-JavaJDK {
Get-WmiObject -Class Win32_Product `
| Where-Object {$_.name -match '^java\s\w+\s\w+\s\w+\s\d+\s\w+\s\d+'}`
| Foreach-Object {
[string]$identificadorinstaller=$_.IdentifyingNumber
start-Process msiexec.exe -ArgumentList "/x $identificadorinstaller /qn" -Verb RunAs -wait
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment