Created
August 15, 2025 20:23
-
-
Save BladeWDR/d4430d675d01fcbfe0c13f0abfda3ddc to your computer and use it in GitHub Desktop.
HP Bloatware remover
This file contains hidden or 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
| <# | |
| .DESCRIPTION Removes HP bloatware. | |
| #> | |
| # Get list of HP applications from both registry locations | |
| $Apps = @() | |
| $Apps += Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where-Object { $_.DisplayName -like "*HP*" } # 32 Bit | |
| $Apps += Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where-Object { $_.DisplayName -like "*HP*" } # 64 Bit | |
| # Filter out null DisplayName entries, duplicates, and drivers | |
| $Apps = $Apps | Where-Object { $_.DisplayName -ne $null -and $_.DisplayName -notlike "*driver*" } | Sort-Object DisplayName -Unique | |
| if ($Apps.Count -eq 0) | |
| { | |
| Write-Host "No HP applications found to uninstall." | |
| exit | |
| } | |
| Write-Host "Found $($Apps.Count) HP application(s):" | |
| foreach($app in $Apps) | |
| { | |
| Write-Host "- $($app.DisplayName)" | |
| } | |
| # Confirm before proceeding | |
| $confirmation = Read-Host "`nDo you want to proceed with uninstalling these applications? (y/N)" | |
| if ($confirmation -notmatch '^[Yy]') | |
| { | |
| Write-Host "Operation cancelled." | |
| exit | |
| } | |
| foreach($app in $Apps) | |
| { | |
| Write-Host "`nUninstalling: $($app.DisplayName)" | |
| if ([string]::IsNullOrEmpty($app.UninstallString)) | |
| { | |
| Write-Warning "No uninstall string found for $($app.DisplayName)" | |
| continue | |
| } | |
| try | |
| { | |
| # Handle MSI uninstallers (quiet mode) | |
| if ($app.UninstallString -like "*msiexec*") | |
| { | |
| # Extract the MSI product code | |
| $productCode = ($app.UninstallString -split "/I|/X")[1].Trim() | |
| $arguments = "/X$productCode /quiet /norestart" | |
| Start-Process "msiexec.exe" -ArgumentList $arguments -Wait -NoNewWindow | |
| Write-Host "Successfully uninstalled: $($app.DisplayName)" -ForegroundColor Green | |
| } | |
| # Handle other uninstallers | |
| else | |
| { | |
| # Split uninstall string into executable and arguments | |
| if ($app.UninstallString.StartsWith('"')) | |
| { | |
| $execPath = ($app.UninstallString -split '"')[1] | |
| $arguments = ($app.UninstallString -split '"', 3)[2].Trim() | |
| } else | |
| { | |
| $parts = $app.UninstallString -split ' ', 2 | |
| $execPath = $parts[0] | |
| $arguments = if ($parts.Length -gt 1) | |
| { $parts[1] | |
| } else | |
| { "" | |
| } | |
| } | |
| # Add silent/quiet flags if not present | |
| if ($arguments -notmatch "/S|/silent|/quiet|/q") | |
| { | |
| $arguments += " /S" | |
| } | |
| Start-Process $execPath -ArgumentList $arguments -Wait -NoNewWindow | |
| Write-Host "Successfully uninstalled: $($app.DisplayName)" -ForegroundColor Green | |
| } | |
| } catch | |
| { | |
| Write-Error "Failed to uninstall $($app.DisplayName): $($_.Exception.Message)" | |
| } | |
| } | |
| Write-Host "`nUninstallation process completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment