Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active April 25, 2024 07:12
Show Gist options
  • Star 87 You must be signed in to star a gist
  • Fork 23 You must be signed in to fork a gist
  • Save mark05e/a79221b4245962a477a49eb281d97388 to your computer and use it in GitHub Desktop.
Save mark05e/a79221b4245962a477a49eb281d97388 to your computer and use it in GitHub Desktop.
Remove HP bloatware
# ██████╗ ███████╗███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ██╗██████╗
# ██╔══██╗██╔════╝████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ██║██╔══██╗
# ██████╔╝█████╗ ██╔████╔██║██║ ██║██║ ██║█████╗ ███████║██████╔╝
# ██╔══██╗██╔══╝ ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██║██╔═══╝
# ██║ ██║███████╗██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██║ ██║██║
# ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝╚═╝
#
# ██████╗ ██╗ ██████╗ █████╗ ████████╗██╗ ██╗ █████╗ ██████╗ ███████╗
# ██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔════╝
# ██████╔╝██║ ██║ ██║███████║ ██║ ██║ █╗ ██║███████║██████╔╝█████╗
# ██╔══██╗██║ ██║ ██║██╔══██║ ██║ ██║███╗██║██╔══██║██╔══██╗██╔══╝
# ██████╔╝███████╗╚██████╔╝██║ ██║ ██║ ╚███╔███╔╝██║ ██║██║ ██║███████╗
# ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
#
# Remove HP bloatware / crapware
#
# -- source : https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388
# -- contrib: francishagyard2, mark05E, erottier, JoachimBerghmans, sikkepitje
# -- ref : https://community.spiceworks.com/topic/2296941-powershell-script-to-remove-windowsapps-folder?page=1#entry-9032247
# -- note : this script could use your improvements. contributions welcome!
# -- todo : Wolf Security improvements ref: https://www.reddit.com/r/SCCM/comments/nru942/hp_wolf_security_how_to_remove_it/
# 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 Client Security Manager"
"HP Connection Optimizer"
"HP Documentation"
"HP MAC Address Manager"
"HP Notifications"
"HP Security Update Service"
"HP System Default Settings"
"HP Sure Click"
"HP Sure Click Security Browser"
"HP Sure Run"
"HP Sure Recover"
"HP Sure Sense"
"HP Sure Sense Installer"
"HP Wolf Security"
"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}
# 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)]"}
}
# 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)]"}
}
# 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)"
}
# # 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."}
# }
@mark05e
Copy link
Author

mark05e commented Aug 8, 2022

@azumukupoe - Thank You. This has been fixed.

@duaneking
Copy link

FYI; HP is hiding these in drivers from windows update now.

@Ithendyr
Copy link

I use this script with a Pro-Active Remediation on Intune to uninstall HP Bloatwares but got recurred runs.
Tried to uninstall HP Wolf Security but constantly got message "Fallback to MSI uninistall for HP Wolf Security initiated" and applications didn't uninstalled.
2022-11-21 16_30_04-Administrateur _ Windows PowerShell

(This is the list of installed HP programs after the script run)
2022-11-21 16_41_26-Administrateur _ Windows PowerShell


Modified the script on my side to disable the "Fallback attempts" parts and modified the "Remove installed programs" part to add a MSI uninstallation attempt instead of a raw GUID.
First, i've added "HP Wolf Security - Console" to the programs list to uninstall.

# List of programs to uninstall
$UninstallPrograms = @(
    "HP Client Security Manager"
    "HP Connection Optimizer"
    "HP Documentation"
    "HP MAC Address Manager"
    "HP Notifications"
    "HP Security Update Service"
    "HP System Default Settings"
    "HP Sure Click"
    "HP Sure Click Security Browser"
    "HP Sure Run"
    "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"
)

Then modified the script. Below you can find the modified part.
I validated the command lines manually but didn't validate the script for now.
2022-11-21 16_46_10-Administrateur _ Windows PowerShell

# 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 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)]" }
	}
}

Finally, the script indicate he have uninstalled "HP Documentation" but still present on computer. Didn't succeed to uninstall it with msiexec. I will search again when i got some time.

@CasperStekelenburg
Copy link

Please do not use win32_product! querying win32_product can be bad: https://gregramsey.net/2012/02/20/win32_product-is-evil/

@mark05e
Copy link
Author

mark05e commented Nov 25, 2022

  	$product = Get-WmiObject win32_product | where { $_.name -like "$($_.Name)" }

@CasperStekelenburg Do you know of an alternative to this? The first few results when I search on how to uninstall MSI, includes Get-WmiObject -Class Win32_Product


EDIT: I have added the changes here. If anyone can test this and provide feedback, that would be appreciated.

Remove-HPbloatware-beta.ps1

@CasperStekelenburg
Copy link

I'd try searching the registry for the uninstallstring or IdentifyingNumber.
I'd search in "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" or "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

@insr33
Copy link

insr33 commented Nov 28, 2022

I seem to have problems to reinstall "HP Support assistant" after running the script. "There was an unknown error -2"
I ended up reinstalling a clean win10 to be sure all crap is removed :) The rest is handled with autopilot

@666gene
Copy link

666gene commented Dec 9, 2022

Gonna test this out today on 5 or so machines. looking forward to it THANKS!

@toelpel
Copy link

toelpel commented Dec 16, 2022

Thank you all for the great scripts and valuable comments.
I have rewritten and revised a few lines based on this so that the script can be executed via Intune Proactive Remediation and we were able to reliably remove all HP bloatware on various devices.
I just share here what we have so that everyone can benefit from it.

Detection-Script (Detect-HPBloatware.ps1)

#Detect HP bloatware / crapware
#-- source : https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388

#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 Client Security Manager"
    "HP Connection Optimizer"
    "HP Documentation"
    "HP MAC Address Manager"
    "HP Notifications"
    "HP Security Update Service"
    "HP System Default Settings"
    "HP Sure Click"
    "HP Sure Click Security Browser"
    "HP Sure Run"
    "HP Sure Recover"
    "HP Sure Sense"
    "HP Sure Sense Installer"
)

$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}

$InstalledWolfSecurityPrograms = Get-WmiObject Win32_Product | Where-Object { $_.name -like "HP Wolf Security*" }

if (($InstalledPackages) -or ($ProvisionedPackages) -or ($InstalledPrograms) -or ($InstalledWolfSecurityPrograms)) {
    #Apps detected, need to run removal script
    Write-Host "Apps detected, starting removal script"
    exit 1
}

Write-Host "No apps detected"
exit 0

Remediation-Script (Remove-HPBloatware.ps1)

#Remove HP bloatware / crapware
#-- source : https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388

#Remove HP Documentation
if (Test-Path "${Env:ProgramFiles}\HP\Documentation\Doc_uninstall.cmd" -PathType Leaf) {
    try {
        Invoke-Item "${Env:ProgramFiles}\HP\Documentation\Doc_uninstall.cmd"
        Write-Host "Successfully removed provisioned package: HP Documentation"
    }
    catch {
        Write-Host "Error Remvoving HP Documentation $($_.Exception.Message)"
    }
}
else {
    Write-Host "HP Documentation is not installed"
}

#Remove HP Support Assistant silently
$HPSAuninstall = "${Env:ProgramFiles(x86)}\HP\HP Support Framework\UninstallHPSA.exe"

if (Test-Path -Path "HKLM:\Software\WOW6432Node\Hewlett-Packard\HPActiveSupport") {
    try {
        Remove-Item -Path "HKLM:\Software\WOW6432Node\Hewlett-Packard\HPActiveSupport"
        Write-Host "HP Support Assistant regkey deleted $($_.Exception.Message)"
    }
    catch {
        Write-Host "Error retreiving registry key for HP Support Assistant: $($_.Exception.Message)"
    }
}
else {
    Write-Host "HP Support Assistant regkey not found"
}

if (Test-Path $HPSAuninstall -PathType Leaf) {
    try {
        & $HPSAuninstall /s /v/qn UninstallKeepPreferences=FALSE
        Write-Host "Successfully removed provisioned package: HP Support Assistant silently"
    }
    catch {
        Write-Host "Error uninstalling HP Support Assistant: $($_.Exception.Message)"
    }
}
else {
    Write-Host "HP Support Assistant Uninstaller not found"
}

#Remove HP Connection Optimizer
$HPCOuninstall = "${Env:ProgramFiles(x86)}\InstallShield Installation Information\{6468C4A5-E47E-405F-B675-A70A70983EA6}\setup.exe"
if (Test-Path $HPCOuninstall -PathType Leaf) {
    Try {
        # Generating uninstall file
        "[InstallShield Silent]
        Version=v7.00
        File=Response File
        [File Transfer]
        OverwrittenReadOnly=NoToAll
        [{6468C4A5-E47E-405F-B675-A70A70983EA6}-DlgOrder]
        Dlg0={6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0
        Count=2
        Dlg1={6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinish-0
        [{6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0]
        Result=6
        [Application]
        Name=HP Connection Optimizer
        Version=2.0.19.0
        Company=HP
        Lang=0413
        [{6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinish-0]
        Result=1
        bOpt1=0
        bOpt2=0" | Out-File -FilePath "${Env:Temp}\uninstallHPCO.iss" -Encoding UTF8 -Force:$true -Confirm:$false

        Write-Host "Successfully created uninstall file ${Env:Temp}\uninstallHPCO.iss"

        & $HPCOuninstall -runfromtemp -l0x0413 -removeonly -s -f1${Env:Temp}\uninstallHPCO.iss
        Write-Host "Successfully removed HP Connection Optimizer"
    }
    Catch {
        Write-Host "Error uninstalling HP Connection Optimizer: $($_.Exception.Message)"
    }
}
Else {
    Write-Host "HP Connection Optimizer not found"
}

#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 Client Security Manager"
    "HP Connection Optimizer"
    "HP Documentation"
    "HP MAC Address Manager"
    "HP Notifications"
    "HP Security Update Service"
    "HP System Default Settings"
    "HP Sure Click"
    "HP Sure Click Security Browser"
    "HP Sure Run"
    "HP Sure Recover"
    "HP Sure Sense"
    "HP Sure Sense Installer"
)

$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 } | Sort-Object Name -Descending

#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)]" }
}

#Remove installed programs
ForEach ($InstalledProgram in $InstalledPrograms) {
    Write-Host -Object "Attempting to uninstall: [$($InstalledProgram.Name)]..."
    try {
        $Null = $InstalledProgram | Uninstall-Package -AllVersions -Force -ErrorAction Stop
        Write-Host -Object "Successfully uninstalled: [$($InstalledProgram.Name)]"
    }
    catch {
        Write-Warning -Message "Failed to uninstall: [$($InstalledProgram.Name)]"
        Write-Host -Object "Attempting to uninstall as MSI package: [$($InstalledProgram.Name)]..."
        try {
            $MSIApp = Get-WmiObject Win32_Product | Where-Object { $_.name -like "$($InstalledProgram.Name)" }
            if ($null -ne $MSIApp.IdentifyingNumber) {
                Start-Process -FilePath msiexec.exe -ArgumentList @("/x $($MSIApp.IdentifyingNumber)", "/quiet", "/noreboot") -Wait
            }
            else { Write-Warning -Message "Can't find MSI package: [$($InstalledProgram.Name)]" }
        }
        catch { Write-Warning -Message "Failed to uninstall MSI package: [$($InstalledProgram.Name)]" }
    }
}

#Try to remove all HP Wolf Security apps using msiexec
$InstalledWolfSecurityPrograms = Get-WmiObject Win32_Product | Where-Object { $_.name -like "HP Wolf Security*" }
ForEach ($InstalledWolfSecurityProgram in $InstalledWolfSecurityPrograms) {
    try {
        if ($null -ne $InstalledWolfSecurityProgram.IdentifyingNumber) {
            Start-Process -FilePath msiexec.exe -ArgumentList @("/x $($InstalledWolfSecurityProgram.IdentifyingNumber)", "/quiet", "/noreboot") -Wait
            Write-Host "Attempting to uninstall as MSI package: [$($InstalledWolfSecurityProgram.Name)]..."
        }
        else { Write-Warning -Message "Can't find MSI package: [$($InstalledWolfSecurityProgram.Name)]" }
    }
    catch {
        Write-Warning -Message "Failed to uninstall MSI package: [$($InstalledWolfSecurityProgram.Name)]"
    }
}

@mark05e
Copy link
Author

mark05e commented Dec 16, 2022

@toelpel - Thank you for sharing! Looks good.

@divadiow
Copy link

divadiow commented Jan 3, 2023

our machines have "HP Sure Run Module" too so added that

@duaneking
Copy link

I'm finding that this script does not remove a HP package, "HP System Info HSA Service" aka service "HPSysInfoCap"

It looks like its used to update everything else or install it if it does not exist.

On a win11 system, thats located in: C:\Windows\System32\DriverStore\FileRepository\hpcustomcapcomp.inf_amd64_9b42a3e82673e3bb\x64\SysInfoCap.exe

@Zamrod
Copy link

Zamrod commented Jan 17, 2023

@toelpel As above, "HP Sure Run Module" should be added to the list, that's easy enough.

However, it still won't uninstall HP Connection Manager. Each time it runs it says it finds it and uninstalls it but it is still installed.

@sikkepitje
Copy link

I have noticed that there are several services still running after the uninstallation of the detected packages and programs. So I have inserted this little code in the removal script, just before the code that remove appx provisioned packages,

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"
StopDisableService -name "HPNetworkCap"
StopDisableService -name "HPSysInfoCap"
StopDisableService -name "HP TechPulse Core"

I identified these services as associated with the HP apps and packages to uninstall. It's quick and dirty but effective. May be it is not required to uninstall the bloatware , but It may help.

@duaneking
Copy link

Yes, an uninstallation script should shut down the service before it tries to uninstall it. That's valid and sane. I vote it be added to the script.

@mark05e
Copy link
Author

mark05e commented Jan 20, 2023

Included suggestions from @duaneking, @sikkepitje, @Zamrod & @divadiow over at Remove-HPbloatware-beta.ps1

Will update it here after I get positive feedback over there.

Thank you for your contributions.

@666gene
Copy link

666gene commented Jan 20, 2023

Will update this to my environment and report back.

@Zamrod
Copy link

Zamrod commented Feb 2, 2023

@mark05e

A couple of things didn't seem to work. Here's the log when I used ImmyBot to run it:

Successfully removed provisioned package: [AD2F1837.HPDesktopSupportUtilities]
Attempting to remove provisioned package: [AD2F1837.HPPCHardwareDiagnosticsWindows]...
Successfully removed provisioned package: [AD2F1837.HPPCHardwareDiagnosticsWindows]
Attempting to remove provisioned package: [AD2F1837.HPPrivacySettings]...
Successfully removed provisioned package: [AD2F1837.HPPrivacySettings]
Attempting to remove provisioned package: [AD2F1837.HPQuickDrop]...
Successfully removed provisioned package: [AD2F1837.HPQuickDrop]
Attempting to remove provisioned package: [AD2F1837.HPSupportAssistant]...
Successfully removed provisioned package: [AD2F1837.HPSupportAssistant]
Attempting to remove provisioned package: [AD2F1837.myHP]...
Successfully removed provisioned package: [AD2F1837.myHP]
Attempting to remove Appx package: [AD2F1837.HPSupportAssistant]...
Successfully removed Appx package: [AD2F1837.HPSupportAssistant]
Attempting to remove Appx package: [AD2F1837.HPDesktopSupportUtilities]...
Successfully removed Appx package: [AD2F1837.HPDesktopSupportUtilities]
Attempting to remove Appx package: [AD2F1837.HPPrivacySettings]...
Successfully removed Appx package: [AD2F1837.HPPrivacySettings]
Attempting to remove Appx package: [AD2F1837.HPQuickDrop]...
Successfully removed Appx package: [AD2F1837.HPQuickDrop]
Attempting to remove Appx package: [AD2F1837.HPPCHardwareDiagnosticsWindows]...
Successfully removed Appx package: [AD2F1837.HPPCHardwareDiagnosticsWindows]
Attempting to remove Appx package: [AD2F1837.myHP]...
Successfully removed Appx package: [AD2F1837.myHP]
Attempting to uninstall: [HP Documentation]...
Successfully uninstalled: [HP Documentation]
Attempting to uninstall: [HP Notifications]...
Successfully uninstalled: [HP Notifications]
Attempting to uninstall: [HP System Default Settings]...
Successfully uninstalled: [HP System Default Settings]
Attempting to uninstall: [HP Connection Optimizer]...
Successfully uninstalled: [HP Connection Optimizer]
Fallback to MSI uninistall for HP Wolf Security initiated
Fallback to MSI uninistall for HP Wolf 2 Security initiated
Checking stuff after running script
For Get-AppxPackage -AllUsers

Name                   : RealtekSemiconductorCorp.HPAudioControl
Publisher              : CN=83564403-0B26-46B8-9D84-040F43691D31
PublisherId            : dt26b99r8h8gj
Architecture           : X64
ResourceId             :
Version                : 2.31.259.0
PackageFamilyName      : RealtekSemiconductorCorp.HPAudioControl_dt26b99r8h8gj
PackageFullName        : RealtekSemiconductorCorp.HPAudioControl_2.31.259.0_x64__dt26b99r8h8gj
InstallLocation        : C:\Program Files\WindowsApps\RealtekSemiconductorCorp.HPAudioControl_2.31.259.0_x64__dt26b99r8h8gj
IsFramework            : False
PackageUserInformation : {S-1-5-18 [NT AUTHORITY\SYSTEM]: Staged}
IsResourcePackage      : False
IsBundle               : False
IsDevelopmentMode      : False
NonRemovable           : False
Dependencies           : {}
IsPartiallyStaged      : False
SignatureKind          : Store
Status                 : Ok

For Get-AppxProvisionedPackage -Online
Version          : 2.31.259.0
PackageName      : RealtekSemiconductorCorp.HPAudioControl_2.31.259.0_neutral_~_dt26b99r8h8gj
DisplayName      : RealtekSemiconductorCorp.HPAudioControl
PublisherId      : dt26b99r8h8gj
MajorVersion     : 2
MinorVersion     : 31
Build            : 259
Revision         : 0
Architecture     : 11
ResourceId       : ~
InstallLocation  : C:\Program Files\WindowsApps\RealtekSemiconductorCorp.HPAudioControl_2.31.259.0_neutral_~_dt26b99r8h8gj\AppxMetadata\AppxBundleManifest.xml
Regions          : all
Path             :
Online           : True
WinPath          :
SysDrivePath     :
RestartNeeded    : False
LogPath          : C:\windows\Logs\DISM\dism.log
ScratchDirectory :
LogLevel         : WarningsInfo

For Get-Package


Name                 : HP Documentation
FastPackageReference : hklm64\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\HP_Documentation
ProviderName         : Programs
Summary              :

Name                 : HP Connection Optimizer
FastPackageReference : hklm32\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6468C4A5-E47E-405F-B675-A70A70983EA6}
ProviderName         : Programs
Summary              :


Read-Host : Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.
At line:173 char:10
+ $input = Read-Host "Restart computer now [y/n]"
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Read-Host], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ReadHostCommand

@666gene
Copy link

666gene commented Mar 3, 2023

Heads up when i run this. i still have a couple apps still installed after running and restarting.

Output
Attempting to remove provisioned package: [AD2F1837.HPEasyClean]...
Successfully removed provisioned package: [AD2F1837.HPEasyClean]
Attempting to remove provisioned package: [AD2F1837.HPPCHardwareDiagnosticsWindows]...
Successfully removed provisioned package: [AD2F1837.HPPCHardwareDiagnosticsWindows]
Attempting to remove provisioned package: [AD2F1837.HPPowerManager]...
Successfully removed provisioned package: [AD2F1837.HPPowerManager]
Attempting to remove provisioned package: [AD2F1837.HPPrivacySettings]...
Successfully removed provisioned package: [AD2F1837.HPPrivacySettings]
Attempting to remove provisioned package: [AD2F1837.HPQuickDrop]...
Successfully removed provisioned package: [AD2F1837.HPQuickDrop]
Attempting to remove provisioned package: [AD2F1837.HPSupportAssistant]...
Successfully removed provisioned package: [AD2F1837.HPSupportAssistant]
Attempting to remove provisioned package: [AD2F1837.HPSystemInformation]...
Successfully removed provisioned package: [AD2F1837.HPSystemInformation]
Attempting to remove provisioned package: [AD2F1837.myHP]...
Successfully removed provisioned package: [AD2F1837.myHP]
Attempting to remove Appx package: [AD2F1837.HPSupportAssistant]...
Successfully removed Appx package: [AD2F1837.HPSupportAssistant]
Attempting to remove Appx package: [AD2F1837.HPSystemInformation]...
Successfully removed Appx package: [AD2F1837.HPSystemInformation]
Attempting to remove Appx package: [AD2F1837.HPEasyClean]...
Successfully removed Appx package: [AD2F1837.HPEasyClean]
Attempting to remove Appx package: [AD2F1837.HPQuickDrop]...
Successfully removed Appx package: [AD2F1837.HPQuickDrop]
Attempting to remove Appx package: [AD2F1837.HPPCHardwareDiagnosticsWindows]...
Successfully removed Appx package: [AD2F1837.HPPCHardwareDiagnosticsWindows]
Attempting to remove Appx package: [AD2F1837.myHP]...
Successfully removed Appx package: [AD2F1837.myHP]
Attempting to remove Appx package: [AD2F1837.HPPowerManager]...
Successfully removed Appx package: [AD2F1837.HPPowerManager]
Attempting to remove Appx package: [AD2F1837.HPPrivacySettings]...
Successfully removed Appx package: [AD2F1837.HPPrivacySettings]
Attempting to uninstall: [HP Documentation]...
Successfully uninstalled: [HP Documentation]
Attempting to uninstall: [HP Client Security Manager]...
Successfully uninstalled: [HP Client Security Manager]
Attempting to uninstall: [HP Wolf Security]...
Successfully uninstalled: [HP Wolf Security]
Attempting to uninstall: [HP Sure Run Module]...
Successfully uninstalled: [HP Sure Run Module]
Attempting to uninstall: [HP Wolf Security Application Support for Sure Sense]...
Successfully uninstalled: [HP Wolf Security Application Support for Sure Sense]
Attempting to uninstall: [HP Notifications]...
Successfully uninstalled: [HP Notifications]
Attempting to uninstall: [HP Security Update Service]...
Successfully uninstalled: [HP Security Update Service]
Attempting to uninstall: [HP Sure Recover]...
Successfully uninstalled: [HP Sure Recover]
Attempting to uninstall: [HP System Default Settings]...
Successfully uninstalled: [HP System Default Settings]
Attempting to uninstall: [HP Connection Optimizer]...
Successfully uninstalled: [HP Connection Optimizer]
Fallback to MSI uninistall for HP Wolf Security initiated
Fallback to MSI uninistall for HP Wolf 2 Security initiated
This action is only valid for products that are currently installed.

This action is only valid for products that are currently installed.

The apps still installed are
"HP Connection Optimizer"
"HP Documentation"
"ICS"

@andygresbach
Copy link

has anyone been able to FULLY remove HP Auto Lock and Awake with this? we found that in some systems its updated to HP Presense Aware and we can get that to remove from the installed apps (as well as not showing in the power and sleep settings. However you can still search for HP Auto Lock and Awake under windows settings so somehow still has its hooks in the system . we are looking for how we can detect this and of course fully remove it. any ideas?
autolock

@izenn
Copy link

izenn commented May 2, 2023

Looks like Connection Optimizer, HP PC Hardware Diagnostics UEFI, ICS, and Collaboration Keyboard don't remove correctly through the script.

i found this for the connection optimizer (looks like it needs an ISS file):
https://www.reddit.com/r/PowerShell/comments/mwdrvb/comment/hpcrmiu/?utm_source=share&utm_medium=web2x&context=3

Here is how i adapted it to fit into the script (i put it right before the show what's left behind section - it probably should be put in a try...):

$ConnOpt = "[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-DlgOrder]
Dlg0={6468C4A5-E47E-405F-B675-A70A70983EA6}-SdWelcomeMaint-0
Count=3
Dlg1={6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0
Dlg2={6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinishReboot-0
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-SdWelcomeMaint-0]
Result=303
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0]
Result=6
[Application]
Name=HP Connection Optimizer
Version=2.0.18.0
Company=HP Inc.
Lang=0409
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinishReboot-0]
Result=1
BootOption=0"

$ConnOpt | Out-File c:\Windows\Temp\ISS-HP.iss

&'C:\Program Files (x86)\InstallShield Installation Information\{6468C4A5-E47E-405F-B675-A70A70983EA6}\setup.exe' @('-s', '-f1C:\Windows\Temp\ISS-HP.iss')

@vince-vibin
Copy link

vince-vibin commented May 23, 2023

for anyone that needs it here is my implementation of the HP Bloatware removal. This is only part of a script we use, the whole script also removes a bunch of default windows apps and more.
Hope this helps :)

$apps = @(
    # HP Bloatware
    "HP Connection Optimizer"
    "HP Documentation"
    "HP Notifications"
    "HP Security Update Service"
    "HP Sure Recover"
    "HP Sure Run Module"
    "HP Wolf Security - Console"
    "HP Wolf Security"

    "AD2F1837.HPEasyClean"
    "AD2F1837.HPPCHardwareDiagnosticsWindows"
    "AD2F1837.HPPowerManager"
    "AD2F1837.HPPrivacySettings"
    "AD2F1837.HPQuickDrop"
    "AD2F1837.HPSupportAssistant"
    "AD2F1837.HPSystemInformation"
    "AD2F1837.myHP"
)
# used for uninstall of HP Connection Optimizer 
# check out this for more info https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388
$ConnOpt = "[InstallShield Silent]
Version=v7.00
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-DlgOrder]
Dlg0={6468C4A5-E47E-405F-B675-A70A70983EA6}-SdWelcomeMaint-0
Count=3
Dlg1={6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0
Dlg2={6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinishReboot-0
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-SdWelcomeMaint-0]
Result=303
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0]
Result=6
[Application]
Name=HP Connection Optimizer
Version=2.0.18.0
Company=HP Inc.
Lang=0409
[{6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinishReboot-0]
Result=1
BootOption=0"

$appxprovisionedpackages = Get-AppxProvisionedPackage -Online

foreach ($app in $apps) {
    Write-Output "Trying to remove $app"

    # remove appx packages
    if ((Get-AppxPackage -AllUsers).Name -eq "$app") {
        Get-AppxPackage $app -AllUsers | Remove-AppxPackage -AllUsers | Out-Null
        if ($?) {
            Write-Host "    Successfully removed AppX-Package $app"
            Continue
        } else {
            Write-Host "    Failed to remove AppX-Package $app"
            Continue
        }

        ($appxprovisionedpackages).Where( {$_.DisplayName -EQ $app}) |
            Remove-AppxProvisionedPackage -Online
        if (!$?) {
            Write-Host "    Failed to remove AppX-ProvisionedPackage $app"
        } else {
            Write-Host "    Removed AppX-ProvisionedPackage $app"
        }
        Continue
    }

    # remove normal packages
    Get-Package -Name $app -ErrorAction SilentlyContinue | Out-Null
    if ($?) {
        Uninstall-Package -Name $app -AllVersions -Force
        if (!$?) {
            Write-Host "Failed to remove $app"
        } else {
            # in some cases uninstall command returns a successfull but doesnt actually uninstall the Package
            # https://github.com/OneGet/oneget/issues/435
            # as a last effort i try to remove the Package using the UninstallString
            Get-Package -Name $item -ErrorAction SilentlyContinue | Out-Null
            if ($?) {
                Write-Host "    Couldn't remove Package due to bug. Trying via Uninstallstring..."
                # remove Programms via uninstallString because Remove-Package doesnt work :(
                if ($app -eq "HP Documentation") {
                    try {
                        $uninstallString = "C:\Program Files\HP\Documentation\Doc_uninstall.cmd"
                        Start-Process -FilePath "$uninstallString" -NoNewWindow
                        Write-Host "    Successfully removed HP Documentation via uninstall string"
                    } catch {
                        Write-Host "    Failed to remove HP Documentation via uninstall string"
                    }
                } elseif ($app -eq "HP Connection Optimizer") {
                    try {
                        $ConnOpt | Out-File c:\Windows\Temp\ISS-HP.iss
                        &'C:\Program Files (x86)\InstallShield Installation Information\{6468C4A5-E47E-405F-B675-A70A70983EA6}\setup.exe' @('-s', '-f1C:\Windows\Temp\ISS-HP.iss')
                        
                        Write-Host "    Successfully removed HP Connection Optimizer via uninstallfile"
                    } catch {
                        Write-Host "    Couldnt create uninstallfile for HP Connection Optimizer"
                    }
                }
            }   
        }
    }
}

@Hustenstopper
Copy link

Hustenstopper commented Jul 25, 2023

Great Script. Thanks. :-)

Found some more HP garbage on a actual ProBook 450 G10.
I'll leave you a few printscreens of the respective uninstall hives just in case you like to supplement it in your cleanup-script.

HP TechPulse
HP Touchpoint Analytics Client Dependencys
HP Touchpoint Analytics Client
ICS

ICS is Charging Scheduler. Honstly i don't know if that one should be removed at all.

Edit: Just figured out that the "HP Touchpoint Analytics Client Dependencys" seems to be uninstalled together with "HP Touchpoint Analytics Client" allready.

@loopyd
Copy link

loopyd commented Aug 5, 2023

I did a little work:

https://gist.github.com/loopyd/07a7242ece52793c29947481324822c6

Just to clean things up a bit.

@fasteddys
Copy link

Hello, nice work, can you remove bloat ware HPCaaSClientLib.dll , it keeps reinstalling itself everytime

https://community.spiceworks.com/topic/2310773-remove-all-hp-apps

C:\WINDOWS\System32\DriverStore\FileRepository\hpanalyticscomp.inf_amd64_43 ......\x64\HPCaaSClientLib.dll

@djsvi
Copy link

djsvi commented Nov 3, 2023

Hi, here is some suggested code for handling the aggressively persistent HP spyware services..

# Uninstalling the drivers disables and (on reboot) removes the installed services.
# At this stage the only 'HP Inc.' driver we want to keep is HPSFU, used for firmware servicing.

$EvilDrivers = Get-WindowsDriver -Online | ? {$_.ProviderName -eq 'HP Inc.' -and $_.OriginalFileName -notlike '*\hpsfuservice.inf'}
$EvilDrivers | % {Write-Output "Removing driver: $($_.OriginalFileName.toString())"; pnputil /delete-driver $_.Driver /uninstall /force}

# Once the drivers are gone lets disable installation of 'drivers' for these HP 'devices' (typically automatic via Windows Update)
# SWC\HPA000C = HP Device Health Service
# SWC\HPIC000C = HP Application Enabling Services
# SWC\HPTPSH000C = HP Services Scan
# ACPI\HPIC000C = HP Application Driver

$RegistryPath = 'HKLM:\Software\Policies\Microsoft\Windows\DeviceInstall\Restrictions\DenyDeviceIDs'

If (! (Test-Path $RegistryPath)) { New-Item -Path $RegistryPath -Force | Out-Null }

New-ItemProperty -Path $RegistryPath -Name '1' -Value 'SWC\HPA000C' -PropertyType STRING
New-ItemProperty -Path $RegistryPath -Name '2' -Value 'SWC\HPIC000C' -PropertyType STRING
New-ItemProperty -Path $RegistryPath -Name '3' -Value 'SWC\HPTPSH000C' -PropertyType STRING
New-ItemProperty -Path $RegistryPath -Name '4' -Value 'ACPI\HPIC000C' -PropertyType STRING

$RegistryPath = 'HKLM:\Software\Policies\Microsoft\Windows\DeviceInstall\Restrictions'

New-ItemProperty -Path $RegistryPath -Name 'DenyDeviceIDs' -Value '1' -PropertyType DWORD
New-ItemProperty -Path $RegistryPath -Name 'DenyDeviceIDsRetroactive' -Value '1' -PropertyType DWORD

@hako9
Copy link

hako9 commented Jan 11, 2024

hp0ne
Screenshot 2024-01-11 230751
Screenshot 2024-01-12 001114
Screenshot 2024-01-12 001153

@Netweezurd
Copy link

Netweezurd commented Feb 14, 2024

Hi everyone... this is an OLD thread. Please don't resurect.
By the same guy, Mark, his present script is :
Remove-HPbloatware-beta.ps1
The one posted at the bottom of the comments works quite well.

@kiquenet
Copy link

which script is valid for 2024 ? a HP EliteBook 650 15.6 inch G9 Notebook PC with Windows 11 versión 23H2

@ll4mat
Copy link

ll4mat commented Apr 25, 2024

which script is valid for 2024 ? a HP EliteBook 650 15.6 inch G9 Notebook PC with Windows 11 versión 23H2

Did you even read the comment from @Netweezurd above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment