100 lines
2.5 KiB
PowerShell
100 lines
2.5 KiB
PowerShell
# Remove HP Bloatware - Silent mode with error suppression
|
|
# Run as Administrator
|
|
|
|
#Requires -RunAsAdministrator
|
|
|
|
$ErrorActionPreference = 'SilentlyContinue'
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
# HP Bloatware packages to remove
|
|
$HPApps = @(
|
|
'HP.*Support.*Assistant',
|
|
'HP.*Alerts',
|
|
'HPControlledShutdown',
|
|
'HP.*Cloud.*Recover',
|
|
'HP.*Client.*Services',
|
|
'HP.*Quickdrop',
|
|
'HP.*Photo.*Creations',
|
|
'HP.*Security.*Update',
|
|
'HPIASystemAgent',
|
|
'HP.*Wireless.*Assistant',
|
|
'HP.*Print.*Library',
|
|
'HP.*Wolf.*Security',
|
|
'HPWolfSecurity',
|
|
'HPDeskjet.*',
|
|
'HPOfficejet.*',
|
|
'HPPhotosmart.*',
|
|
'HPEnvy.*',
|
|
'HPLaserJet.*'
|
|
)
|
|
|
|
# Remove via WMI (works for most systems)
|
|
foreach ($app in $HPApps) {
|
|
try {
|
|
$installed = Get-WmiObject -Class Win32_Product -Filter "Name LIKE '$app'" -ErrorAction SilentlyContinue
|
|
foreach ($item in $installed) {
|
|
$item.Uninstall() | Out-Null
|
|
}
|
|
} catch { }
|
|
}
|
|
|
|
# Remove via PowerShell App Removal (Windows 10+)
|
|
foreach ($app in $HPApps) {
|
|
try {
|
|
Get-AppxPackage -Name "*HP*" -AllUsers -ErrorAction SilentlyContinue | Remove-AppxPackage -AllUsers
|
|
} catch { }
|
|
}
|
|
|
|
# Remove HP services
|
|
$HPServices = @(
|
|
'hpsysdrv',
|
|
'HPDrvMaintSvc',
|
|
'HP*'
|
|
)
|
|
|
|
foreach ($service in $HPServices) {
|
|
try {
|
|
$svc = Get-Service -Name $service -ErrorAction SilentlyContinue
|
|
if ($svc) {
|
|
Stop-Service -Name $service -Force
|
|
Set-Service -Name $service -StartupType Disabled
|
|
}
|
|
} catch { }
|
|
}
|
|
|
|
# Remove HP scheduled tasks
|
|
try {
|
|
Get-ScheduledTask -TaskPath "*HP*" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
|
|
} catch { }
|
|
|
|
# Remove HP registry entries and startup items
|
|
try {
|
|
$HPRegPaths = @(
|
|
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*HP*',
|
|
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\*HP*',
|
|
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\*HP*'
|
|
)
|
|
|
|
foreach ($path in $HPRegPaths) {
|
|
Remove-Item -Path $path -Force -Recurse
|
|
}
|
|
} catch { }
|
|
|
|
# Remove HP installation directories
|
|
$HPDirs = @(
|
|
'C:\Program Files\HP',
|
|
'C:\Program Files (x86)\HP',
|
|
'C:\Program Files\Hewlett-Packard',
|
|
'C:\Program Files (x86)\Hewlett-Packard'
|
|
)
|
|
|
|
foreach ($dir in $HPDirs) {
|
|
try {
|
|
if (Test-Path $dir) {
|
|
Remove-Item -Path $dir -Recurse -Force
|
|
}
|
|
} catch { }
|
|
}
|
|
|
|
Write-Host "HP bloatware removal complete." -ForegroundColor Green
|