-
-
Save mark05e/2db81671f39a041a5992a64a77748dc7 to your computer and use it in GitHub Desktop.
# ██████╗ ███████╗███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ██╗██████╗ | |
# ██╔══██╗██╔════╝████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ██║██╔══██╗ | |
# ██████╔╝█████╗ ██╔████╔██║██║ ██║██║ ██║█████╗ ███████║██████╔╝ | |
# ██╔══██╗██╔══╝ ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██║██╔═══╝ | |
# ██║ ██║███████╗██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██║ ██║██║ | |
# ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ | |
# | |
# ██████╗ ██╗ ██████╗ █████╗ ████████╗██╗ ██╗ █████╗ ██████╗ ███████╗ | |
# ██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔════╝ | |
# ██████╔╝██║ ██║ ██║███████║ ██║ ██║ █╗ ██║███████║██████╔╝█████╗ | |
# ██╔══██╗██║ ██║ ██║██╔══██║ ██║ ██║███╗██║██╔══██║██╔══██╗██╔══╝ | |
# ██████╔╝███████╗╚██████╔╝██║ ██║ ██║ ╚███╔███╔╝██║ ██║██║ ██║███████╗ | |
# ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | |
# | |
# ██████╗ ███████╗████████╗ █████╗ | |
# ██╔══██╗██╔════╝╚══██╔══╝██╔══██╗ | |
# ██████╔╝█████╗ ██║ ███████║ | |
# ██╔══██╗██╔══╝ ██║ ██╔══██║ | |
# ██████╔╝███████╗ ██║ ██║ ██║ | |
# ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ | |
# | |
# Remove HP bloatware / crapware - BETA version | |
# | |
# -- source : https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388 | |
# -- contrib: francishagyard2, mark05E, erottier, JoachimBerghmans, sikkepitje, Ithendyr | |
# -- note : this script could use your improvements. contributions welcome! | |
# List of built-in apps to remove | |
$UninstallPackages = @( | |
"AD2F1837.HPJumpStarts" | |
"AD2F1837.HPPCHardwareDiagnosticsWindows" | |
"AD2F1837.HPPowerManager" | |
"AD2F1837.HPPrivacySettings" | |
"AD2F1837.HPSupportAssistant" | |
"AD2F1837.HPSureShieldAI" | |
"AD2F1837.HPSystemInformation" | |
"AD2F1837.HPQuickDrop" | |
"AD2F1837.HPWorkWell" | |
"AD2F1837.myHP" | |
"AD2F1837.HPDesktopSupportUtilities" | |
"AD2F1837.HPQuickTouch" | |
"AD2F1837.HPEasyClean" | |
"AD2F1837.HPSystemInformation" | |
) | |
# List of programs to uninstall | |
$UninstallPrograms = @( | |
"HP Device Access Manager" | |
"HP Client Security Manager" | |
"HP Connection Optimizer" | |
"HP Documentation" | |
"HP MAC Address Manager" | |
"HP Notifications" | |
"HP System Info HSA Service" | |
"HP Security Update Service" | |
"HP System Default Settings" | |
"HP Sure Click" | |
"HP Sure Click Security Browser" | |
"HP Sure Run" | |
"HP Sure Run Module" | |
"HP Sure Recover" | |
"HP Sure Sense" | |
"HP Sure Sense Installer" | |
"HP Wolf Security" | |
"HP Wolf Security - Console" | |
"HP Wolf Security Application Support for Sure Sense" | |
"HP Wolf Security Application Support for Windows" | |
) | |
$HPidentifier = "AD2F1837" | |
$InstalledPackages = Get-AppxPackage -AllUsers ` | |
| Where-Object {($UninstallPackages -contains $_.Name) -or ($_.Name -match "^$HPidentifier")} | |
$ProvisionedPackages = Get-AppxProvisionedPackage -Online ` | |
| Where-Object {($UninstallPackages -contains $_.DisplayName) -or ($_.DisplayName -match "^$HPidentifier")} | |
$InstalledPrograms = Get-Package | Where-Object {$UninstallPrograms -contains $_.Name} | |
# Stop HP Services | |
Function StopDisableService($name) { | |
if (Get-Service -Name $name -ea SilentlyContinue) { | |
Stop-Service -Name $name -Force -Confirm:$False | |
Set-Service -Name $name -StartupType Disabled | |
} | |
} | |
StopDisableService -name "HotKeyServiceUWP" | |
StopDisableService -name "HPAppHelperCap" | |
StopDisableService -name "HP Comm Recover" | |
StopDisableService -name "HPDiagsCap" | |
StopDisableService -name "HotKeyServiceUWP" | |
StopDisableService -name "LanWlanWwanSwitchgingServiceUWP" # do we need to stop this? | |
StopDisableService -name "HPNetworkCap" | |
StopDisableService -name "HPSysInfoCap" | |
StopDisableService -name "HP TechPulse Core" | |
# Remove installed programs | |
$InstalledPrograms | ForEach-Object { | |
Write-Host -Object "Attempting to uninstall: [$($_.Name)]..." | |
Try { | |
$Null = $_ | Uninstall-Package -AllVersions -Force -ErrorAction Stop | |
Write-Host -Object "Successfully uninstalled: [$($_.Name)]" | |
} | |
Catch { | |
Write-Warning -Message "Failed to uninstall: [$($_.Name)]" | |
Write-Host -Object "Attempting to uninstall as MSI package: [$($_.Name)]..." | |
Try { | |
$product = Get-WmiObject win32_product | where { $_.name -like "$($_.Name)" } | |
if ($_ -ne $null) { | |
msiexec /x $product.IdentifyingNumber /quiet /noreboot | |
} | |
else { Write-Warning -Message "Can't find MSI package: [$($_.Name)]" } | |
} | |
Catch { Write-Warning -Message "Failed to uninstall MSI package: [$($_.Name)]" } | |
} | |
} | |
# Fallback attempt 1 to remove HP Wolf Security using msiexec | |
Try { | |
MsiExec /x "{0E2E04B0-9EDD-11EB-B38C-10604B96B11E}" /qn /norestart | |
Write-Host -Object "Fallback to MSI uninistall for HP Wolf Security initiated" | |
} | |
Catch { | |
Write-Warning -Object "Failed to uninstall HP Wolf Security using MSI - Error message: $($_.Exception.Message)" | |
} | |
# Fallback attempt 2 to remove HP Wolf Security using msiexec | |
Try { | |
MsiExec /x "{4DA839F0-72CF-11EC-B247-3863BB3CB5A8}" /qn /norestart | |
Write-Host -Object "Fallback to MSI uninistall for HP Wolf 2 Security initiated" | |
} | |
Catch { | |
Write-Warning -Object "Failed to uninstall HP Wolf Security 2 using MSI - Error message: $($_.Exception.Message)" | |
} | |
# Remove appx provisioned packages - AppxProvisionedPackage | |
ForEach ($ProvPackage in $ProvisionedPackages) { | |
Write-Host -Object "Attempting to remove provisioned package: [$($ProvPackage.DisplayName)]..." | |
Try { | |
$Null = Remove-AppxProvisionedPackage -PackageName $ProvPackage.PackageName -Online -ErrorAction Stop | |
Write-Host -Object "Successfully removed provisioned package: [$($ProvPackage.DisplayName)]" | |
} | |
Catch {Write-Warning -Message "Failed to remove provisioned package: [$($ProvPackage.DisplayName)]"} | |
} | |
# Remove appx packages - AppxPackage | |
ForEach ($AppxPackage in $InstalledPackages) { | |
Write-Host -Object "Attempting to remove Appx package: [$($AppxPackage.Name)]..." | |
Try { | |
$Null = Remove-AppxPackage -Package $AppxPackage.PackageFullName -AllUsers -ErrorAction Stop | |
Write-Host -Object "Successfully removed Appx package: [$($AppxPackage.Name)]" | |
} | |
Catch {Write-Warning -Message "Failed to remove Appx package: [$($AppxPackage.Name)]"} | |
} | |
# # Uncomment this section to see what is left behind | |
# Write-Host "Checking stuff after running script" | |
# Write-Host "For Get-AppxPackage -AllUsers" | |
# Get-AppxPackage -AllUsers | where {$_.Name -like "*HP*"} | |
# Write-Host "For Get-AppxProvisionedPackage -Online" | |
# Get-AppxProvisionedPackage -Online | where {$_.DisplayName -like "*HP*"} | |
# Write-Host "For Get-Package" | |
# Get-Package | select Name, FastPackageReference, ProviderName, Summary | Where {$_.Name -like "*HP*"} | Format-List | |
# # Feature - Ask for reboot after running the script | |
# $input = Read-Host "Restart computer now [y/n]" | |
# switch($input){ | |
# y{Restart-computer -Force -Confirm:$false} | |
# n{exit} | |
# default{write-warning "Skipping reboot."} | |
# } |
Since you are quoting my forked and significantly modified script here, I don't quite understand why you are addressing mark05e?
Regarding the error in the MSI arguments...
I have now adjusted the corresponding function (HP Wolf Fallback) in my fork, especially since I didn't like having to work with hardcoded GUIDs and blindly trying "msiexec /x {GUID} /qn /norestart" anyway.
The output of the MSI itself is now also logged to "C:\Windows\Temp\HPWolfUninstall_.log". Maybe you would like to try again.
I can't really test it at the moment - due to the lack of a suitable system.
Or jeah... use the version from @andrew-s-taylor linked above.
Hi @xxIPREDATORIxx, I placed my own version here: https://github.com/IntuneSpecialist/Intune/tree/main/Powershell%20scripts. Its the same version as I mentioned above but since they never responded I descided to place my own version there.
Hi foeyonghai
How can I keep HP Support Assistant as your script runs very well? Thanks
I ended using this script instead - so far uninstalled all HP bloats except 'HP Performance Advisor'. I will add it to the script.
https://github.com/andrew-s-taylor/public/blob/main/De-Bloat/RemoveBloat.ps1