Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Grab data from registry
- $regQuery32 = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Where {$_.GetValue("DisplayName") -match "Java"}
- $regQuery64 = Get-ChildItem -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Where {$_.GetValue("DisplayName") -match "Java"}
- # Create uninstall strings
- $regQuery32 | ForEach-Object {
- $productCode = $($_.Name).Split("\")[$($_.Name).Split("\").Length - 1]
- $app = Start-Process "msiexec.exe" -ArgumentList "/x $productCode /passive /norestart" -PassThru
- Wait-Process $app.Id
- }
- $regQuery64 | ForEach-Object {
- $productCode = $($_.Name).Split("\")[$($_.Name).Split("\").Length - 1]
- $app = Start-Process "msiexec.exe" -ArgumentList "/x $productCode /passive /norestart" -PassThru
- Wait-Process $app.Id
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement