Advertisement
Guest User

Uninstall Java strings

a guest
Jun 13th, 2014
1,891
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.     $uninstall = "msiexec.exe /x $productCode /passive /norestart"
  9.     Write-Output "$uninstall"
  10. }
  11.  
  12. $regQuery64 | ForEach-Object {
  13.     $productCode = $($_.Name).Split("\")[$($_.Name).Split("\").Length - 1]
  14.     $uninstall = "msiexec.exe /x $productCode /passive /norestart"
  15.     Write-Output "$uninstall"
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement