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]
- $uninstall = "msiexec.exe /x $productCode /passive /norestart"
- Write-Output "$uninstall"
- }
- $regQuery64 | ForEach-Object {
- $productCode = $($_.Name).Split("\")[$($_.Name).Split("\").Length - 1]
- $uninstall = "msiexec.exe /x $productCode /passive /norestart"
- Write-Output "$uninstall"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement