Advertisement
Guest User

Uninstall Java strings

a guest
Jun 16th, 2014
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Grab data from registry
  2. $regQuery32 = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Where {$_.GetValue("DisplayName") -match "Java"}
  3. $regQuery64 = Get-ChildItem -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Where {$_.GetValue("DisplayName") -match "Java"}
  4.  
  5. # Create uninstall strings
  6. $regQuery32 | ForEach-Object {
  7.     $productCode = $($_.Name).Split("\")[$($_.Name).Split("\").Length - 1]
  8.  
  9.     $app = Start-Process "msiexec.exe" -ArgumentList "/x $productCode /passive /norestart" -PassThru
  10.     Wait-Process $app.Id
  11. }
  12.  
  13. $regQuery64 | ForEach-Object {
  14.     $productCode = $($_.Name).Split("\")[$($_.Name).Split("\").Length - 1]
  15.  
  16.     $app = Start-Process "msiexec.exe" -ArgumentList "/x $productCode /passive /norestart" -PassThru
  17.     Wait-Process $app.Id
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement