Created
May 11, 2020 09:30
-
-
Save lumodino/b9cc1761a6677cc97975e2245cf765e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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