-
Star
(142)
You must be signed in to star a gist -
Fork
(38)
You must be signed in to fork a gist
-
-
Save mark05e/a79221b4245962a477a49eb281d97388 to your computer and use it in GitHub Desktop.
| # ██████╗ ███████╗███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ██╗██████╗ | |
| # ██╔══██╗██╔════╝████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ██║██╔══██╗ | |
| # ██████╔╝█████╗ ██╔████╔██║██║ ██║██║ ██║█████╗ ███████║██████╔╝ | |
| # ██╔══██╗██╔══╝ ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██║██╔═══╝ | |
| # ██║ ██║███████╗██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██║ ██║██║ | |
| # ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ | |
| # | |
| # ██████╗ ██╗ ██████╗ █████╗ ████████╗██╗ ██╗ █████╗ ██████╗ ███████╗ | |
| # ██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔════╝ | |
| # ██████╔╝██║ ██║ ██║███████║ ██║ ██║ █╗ ██║███████║██████╔╝█████╗ | |
| # ██╔══██╗██║ ██║ ██║██╔══██║ ██║ ██║███╗██║██╔══██║██╔══██╗██╔══╝ | |
| # ██████╔╝███████╗╚██████╔╝██║ ██║ ██║ ╚███╔███╔╝██║ ██║██║ ██║███████╗ | |
| # ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | |
| # | |
| # 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."} | |
| # } |
Hi!
When we run this script everything will be deleted and not reinstalled but Wolf security.
Anyone has the same issue? If so anyone has a clue how to fix it?
Hi!
When we run this script everything will be deleted and not reinstalled but Wolf security. Anyone has the same issue? If so anyone has a clue how to fix it?
It used to be another HP service like "HP Sure Sense" which silently reinstalled Wolf. If this specific software is still the case, I'm not sure.
We bought our laptops in bulk (well, 80 pcs) so we got the option from our distributer to have them delivered without (HP) bloatware.
Anyway, you now should at least have a direction to search in. Good luck!
Hi!
When we run this script everything will be deleted and not reinstalled but Wolf security. Anyone has the same issue? If so anyone has a clue how to fix it?It used to be another HP service like "HP Sure Sense" which silently reinstalled Wolf. If this specific software is still the case, I'm not sure. We bought our laptops in bulk (well, 80 pcs) so we got the option from our distributer to have them delivered without (HP) bloatware.
Anyway, you now should at least have a direction to search in. Good luck!
Hi Erottier,
We already got it working, with a bit of thinking and a bit of GPT we made a script that removes all. And also logs if the script has failed or succesfully ran.
Hi!
When we run this script everything will be deleted and not reinstalled but Wolf security. Anyone has the same issue? If so anyone has a clue how to fix it?It used to be another HP service like "HP Sure Sense" which silently reinstalled Wolf. If this specific software is still the case, I'm not sure. We bought our laptops in bulk (well, 80 pcs) so we got the option from our distributer to have them delivered without (HP) bloatware.
Anyway, you now should at least have a direction to search in. Good luck!Hi Erottier,
We already got it working, with a bit of thinking and a bit of GPT we made a script that removes all. And also logs if the script has failed or succesfully ran.
Can you maybe share the script?
Hi!
When we run this script everything will be deleted and not reinstalled but Wolf security. Anyone has the same issue? If so anyone has a clue how to fix it?It used to be another HP service like "HP Sure Sense" which silently reinstalled Wolf. If this specific software is still the case, I'm not sure. We bought our laptops in bulk (well, 80 pcs) so we got the option from our distributer to have them delivered without (HP) bloatware.
Anyway, you now should at least have a direction to search in. Good luck!Hi Erottier,
We already got it working, with a bit of thinking and a bit of GPT we made a script that removes all. And also logs if the script has failed or succesfully ran.Can you maybe share the script?
@MrBaas073: it will be cool and helpful :-)
Based on the original script (thank you very much), I used GPT to customize a version for our environment and needs that works well. For anyone who is interested:
Short Summary
This script removes unwanted HP software, services, and scheduled tasks from HP Windows devices while keeping all components needed for Support Assistant and hardware diagnostics.
It is designed for Intune deployment and includes a detection tag file.
🎯 What the Script Removes
HP bloatware AppX packages (JumpStarts, QuickDrop, WorkWell, myHP, EasyClean, etc.)
Classic HP programs, including
HP Wolf Security + components
HP Sure Click / Sure Sense / Sure Run / Sure Recover
HP Client Security Manager
HP Notifications / Security Update Service / Default Settings
HP MAC Address Manager
Poly Lens
HP Insights stack, including
HP Insights (MSI)
Insights Agent / WatchDog / Analytics / Audio Analytics
HP Touchpoint Analytics Client
HP Connection Optimizer (via correct silent InstallShield uninstall)
HP Documentation (via HP's uninstall CMD)
Leftover Start Menu shortcuts (HP Documentation, Miro Offer, TCO Certified)
Registry leftovers for Connection Optimizer & Documentation
🔥 HP Insights doesn’t come back
The script removes every mechanism that HP uses to auto-reinstall Insights:
HP Services Scan
Insights Agent / Analytics / WatchDog services
Scheduled tasks under \HP* and \Hewlett-Packard\HP Wolf Security*
Empty HP task folders
This ensures Insights cannot return after removal.
🧩 What the Script Keeps
To avoid breaking support workflows:
HP Support Assistant
HP PC Hardware Diagnostics
All HSA Servises needed by Support Assistant
HP Hotkey UWP Service
HP LAN/WLAN/WWAN Switching UWP Service
These are required for diagnostics, Fn-keys, and network switching.
script, there you go
<#
Remove HP Bloatware / HP Insights / Connection Optimizer / Documentation
For Intune (detection via tag file)
Keeps:
- HP Support Assistant
- HP PC Hardware Diagnostics Windows
- all *HSA Service* services (App Helper / Diagnostics / Network / System Info)
- HP Hotkey UWP Service
- HP LAN/WLAN/WWAN Switching UWP Service
#>
[CmdletBinding()]
param()
$ErrorActionPreference = "Continue"
Write-Host "===== Starting HP cleanup ====="
# --------------------------------------------------------------------
# 0) Helper function: uninstall programs via registry Uninstall keys
# (only used for Insights / Touchpoint, NOT for Support Assistant)
# --------------------------------------------------------------------
function Invoke-RegistryUninstall {
param(
[string[]]$Patterns
)
$roots = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall",
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
)
foreach ($root in $roots) {
Get-ChildItem $root -ErrorAction SilentlyContinue | ForEach-Object {
$props = Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue
if (-not $props.DisplayName) { continue }
foreach ($pattern in $Patterns) {
if ($props.DisplayName -like $pattern) {
# explicitly protected programs
if ($props.DisplayName -like "*Support Assistant*" -or
$props.DisplayName -like "*PC Hardware Diagnostics*") {
continue
}
$name = $props.DisplayName
$uninstallString = $props.UninstallString
$key = $_.PSChildName
Write-Host ">>> Registry uninstall for: $name"
Write-Host " UninstallString: $uninstallString"
try {
# 1) MSI GUID as key name
if ($key -match "^\{[0-9A-Fa-f\-]{36}\}$") {
Start-Process "msiexec.exe" -ArgumentList "/X$key /qn /norestart" -Wait
Write-Host " -> removed (GUID key)."
continue
}
# 2) MSI via UninstallString
if ($uninstallString -match "msiexec\.exe") {
if ($uninstallString -match "\{[0-9A-Fa-f\-]{36}\}") {
$guid = $Matches[0]
Start-Process "msiexec.exe" -ArgumentList "/X$guid /qn /norestart" -Wait
Write-Host " -> removed (GUID in string)."
continue
}
}
# 3) normal EXE setup
if ($uninstallString) {
if ($uninstallString.StartsWith('"')) {
$exe = $uninstallString.Split('"')[1]
$args = $uninstallString.Substring($exe.Length + 2).Trim()
} else {
$exe = $uninstallString.Split(" ")[0]
$args = $uninstallString.Substring($exe.Length).Trim()
}
if ($args -notmatch "/quiet" -and $args -notmatch "/s") {
$args += " /quiet /norestart"
}
Start-Process $exe -ArgumentList $args -Wait
Write-Host " -> removed (EXE)."
}
}
catch {
Write-Warning " Error during uninstall: $($_.Exception.Message)"
}
}
}
}
}
}
# --------------------------------------------------------------------
# 1) Remove AppX and provisioned packages (keep Support Assistant, HW Diagnostics)
# --------------------------------------------------------------------
$UninstallPackages = @(
"AD2F1837.HPJumpStarts"
# "AD2F1837.HPPCHardwareDiagnosticsWindows" # AppX, desktop variant is kept
"AD2F1837.HPPowerManager"
"AD2F1837.HPPrivacySettings"
# "AD2F1837.HPSupportAssistant" # if it must be kept
"AD2F1837.HPSureShieldAI"
"AD2F1837.HPSystemInformation"
"AD2F1837.HPQuickDrop"
"AD2F1837.HPWorkWell"
"AD2F1837.myHP"
"AD2F1837.HPDesktopSupportUtilities"
"AD2F1837.HPQuickTouch"
"AD2F1837.HPEasyClean"
"AD2F1837.HPSystemInformation"
"AD2F1837.11510256BE195"
)
Write-Host "Removing HP AppX / provisioned packages…"
$InstalledAppx = Get-AppxPackage -AllUsers | Where-Object { $UninstallPackages -contains $_.Name }
$ProvAppx = Get-AppxProvisionedPackage -Online | Where-Object { $UninstallPackages -contains $_.DisplayName }
foreach ($p in $ProvAppx) {
Write-Host " Provisioned: $($p.DisplayName)"
try {
Remove-AppxProvisionedPackage -Online -PackageName $p.PackageName | Out-Null
} catch {}
}
foreach ($p in $InstalledAppx) {
Write-Host " AppX: $($p.Name)"
try {
Remove-AppxPackage -Package $p.PackageFullName -AllUsers | Out-Null
} catch {}
}
# --------------------------------------------------------------------
# 2) Programs via Get-Package (HP Wolf, Sure*, etc.)
# --------------------------------------------------------------------
Write-Host "Removing defined HP programs (Get-Package)…"
$UninstallPrograms = @(
"HP Client Security Manager"
"HP Connection Optimizer" # additionally handled explicitly
"HP Documentation" # additionally handled explicitly
"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"
"Poly Lens"
"HP Insights"
"HP Insights Agent"
"HP Insights Analytics"
"HP Insights WatchDog Service"
"HP Touchpoint Analytics Client"
)
$pattern = ($UninstallPrograms | ForEach-Object { [Regex]::Escape($_) }) -join "|"
$InstalledPrograms = Get-Package -ErrorAction SilentlyContinue | Where-Object {
$_.Name -match $pattern
}
foreach ($pkg in $InstalledPrograms) {
Write-Host " Get-Package uninstall: $($pkg.Name)"
try {
$pkg | Uninstall-Package -AllVersions -Force -ErrorAction Stop | Out-Null
} catch {
Write-Warning " Error: $($_.Exception.Message)"
}
}
# --------------------------------------------------------------------
# 3) Fallback via Win32_Product (slow, but okay one-time)
# --------------------------------------------------------------------
Write-Host "Searching additional HP programs via Win32_Product…"
$appList = Get-WmiObject -Class Win32_Product -ErrorAction SilentlyContinue | Where-Object {
($_.Name -like '*HP Wolf Security*') -or
($_.Name -like '*Poly Lens*') -or
($_.Name -like '*HP Sure Recover*') -or
($_.Name -match 'ICS') -or
($_.Name -like '*HP Security Update Service*') -or
($_.Name -like '*HP Notifications*') -or
($_.Name -like '*HP Connection Optimizer*') -or
($_.Name -like '*HP Documentation*') -or
($_.Name -like '*HP Insights*') -or
($_.Name -like '*HP Touchpoint Analytics*')
}
foreach ($app in $appList) {
Write-Host " Win32_Product uninstall: $($app.Name)"
try {
$null = $app.Uninstall()
} catch {
Write-Warning " Error: $($_.Exception.Message)"
}
}
# --------------------------------------------------------------------
# 4) MSI fallbacks (Wolf Security & old Connection Optimizer GUID)
# --------------------------------------------------------------------
Write-Host "Running MSI fallback uninstallers…"
$wolfGuids = @(
"{0E2E04B0-9EDD-11EB-B38C-10604B96B11E}",
"{4DA839F0-72CF-11EC-B247-3863BB3CB5A8}"
)
foreach ($guid in $wolfGuids) {
try {
Start-Process "msiexec.exe" -ArgumentList "/X$guid /qn /norestart" -Wait -ErrorAction Stop
Write-Host " Wolf Security GUID removed: $guid"
} catch {}
}
try {
# if this old MSI version is present
Start-Process "msiexec.exe" -ArgumentList "/X{FCC74B77-EC3E-4DD8-A80B-008A702075A9} /qn /norestart" -Wait -ErrorAction SilentlyContinue
Write-Host " HP Connection Optimizer (MSI GUID) removed (if present)."
} catch {}
# --------------------------------------------------------------------
# 5) HP Connection Optimizer – exact InstallShield uninstall
# --------------------------------------------------------------------
Write-Host "HP Connection Optimizer (InstallShield)…"
$coExe = "C:\Program Files (x86)\InstallShield Installation Information\{6468C4A5-E47E-405F-B675-A70A70983EA6}\setup.exe"
if (Test-Path $coExe) {
try {
$args = "-runfromtemp -l0x0407 -removeonly /s"
Write-Host " -> $coExe $args"
Start-Process $coExe -ArgumentList $args -Wait -ErrorAction Stop
Write-Host " -> HP Connection Optimizer uninstalled."
}
catch {
Write-Warning " -> Error uninstalling HP Connection Optimizer: $($_.Exception.Message)"
}
} else {
Write-Host " HP Connection Optimizer setup.exe not found – maybe already removed."
}
# --------------------------------------------------------------------
# 6) HP Documentation – exact CMD uninstall
# --------------------------------------------------------------------
Write-Host "HP Documentation…"
$docCmd = "C:\Program Files\HP\Documentation\Doc_Uninstall.cmd"
if (Test-Path $docCmd) {
try {
Start-Process "cmd.exe" -ArgumentList "/c `"$docCmd`"" -Wait -ErrorAction Stop
Write-Host " -> HP Documentation uninstalled."
}
catch {
Write-Warning " -> Error uninstalling HP Documentation: $($_.Exception.Message)"
}
} else {
Write-Host " HP Documentation not found – maybe already removed."
}
# --------------------------------------------------------------------
# 7) HP Insights – proper MSI uninstall (instead of /I)
# --------------------------------------------------------------------
Write-Host "HP Insights (MSI)…"
$insightsGuid = "{B1C44EC2-0AB5-4777-9EAF-532196758090}"
try {
Start-Process "msiexec.exe" -ArgumentList "/X$insightsGuid /qn /norestart" -Wait -ErrorAction Stop
Write-Host " -> HP Insights uninstalled."
}
catch {
Write-Warning " -> Error uninstalling HP Insights: $($_.Exception.Message)"
}
# additionally try to catch other Insights / Touchpoint variants
Invoke-RegistryUninstall -Patterns @(
"*HP Insights*",
"*HP Touchpoint Analytics*"
)
# --------------------------------------------------------------------
# 8) Remove HP Insights / Analytics / auto-installer services
# (Support Assistant & all *HSA Service* are kept!)
# --------------------------------------------------------------------
Write-Host "Cleaning up HP Insights-related services…"
# 8.1 Exact, safe service names:
$hpInsightsServiceNames = @(
"HP Services Scan",
"HP Insights Agent",
"HP Insights WatchDog Service",
"HP Audio Analytics Service"
)
foreach ($svcName in $hpInsightsServiceNames) {
$svc = Get-Service -Name $svcName -ErrorAction SilentlyContinue
if ($null -ne $svc) {
Write-Host " Exact: stopping and deleting $($svc.DisplayName)"
try {
if ($svc.Status -ne "Stopped") {
Stop-Service -Name $svc.Name -Force -ErrorAction SilentlyContinue
}
sc.exe delete "$($svc.Name)" | Out-Null
} catch {
Write-Warning " Error removing service $($svc.DisplayName): $($_.Exception.Message)"
}
}
}
# 8.2 Pattern-based cleanup (without touching HSA / hotkey / switching services)
$hpSvcPatterns = @(
"*Insights*",
"*Touchpoint*",
"*Audio Analytics*"
)
$protectedPatterns = @(
"*HSA Service*", # keep all HSA services
"*Support Assistant*", # in case of a dedicated service
"*Hotkey UWP Service*",
"*LAN/WLAN/WWAN Switching UWP Service*"
)
foreach ($svc in Get-Service -ErrorAction SilentlyContinue) {
$name = $svc.DisplayName
if (-not $name) { continue }
# protection: services that must never be removed
$isProtected = $false
foreach ($pp in $protectedPatterns) {
if ($name -like $pp) {
$isProtected = $true
break
}
}
if ($isProtected) { continue }
foreach ($pat in $hpSvcPatterns) {
if ($name -like $pat) {
Write-Host " Pattern: stopping and deleting $name"
try {
if ($svc.Status -ne "Stopped") {
Stop-Service -Name $svc.Name -Force -ErrorAction SilentlyContinue
}
sc.exe delete "$($svc.Name)" | Out-Null
} catch {
Write-Warning " Error removing service $($name): $($_.Exception.Message)"
}
break
}
}
}
# --------------------------------------------------------------------
# 9) Clean up HP scheduled tasks
# - remove unwanted HP tasks
# - remove empty HP task folders
# --------------------------------------------------------------------
Write-Host "Cleaning up HP scheduled tasks…"
# Which task names should be removed?
$hpTaskNamePatternsToRemove = @(
"*HP Insights*",
"*Touchpoint*",
"*Analytics*",
"Consent Manager Launcher"
)
# Which task paths should be cleaned up?
$hpTaskPathPatternsToRemove = @(
"\HP\*",
"\Hewlett-Packard\HP Wolf Security\*"
)
# Which tasks/folders must be kept?
$hpTaskProtectedPatterns = @(
"*Support Assistant*"
)
# 9.1 Remove tasks
$allTasks = Get-ScheduledTask -ErrorAction SilentlyContinue
foreach ($task in $allTasks) {
$remove = $false
# match by task name
foreach ($p in $hpTaskNamePatternsToRemove) {
if ($task.TaskName -like $p) {
$remove = $true
break
}
}
# match by task path (if not already decided)
if (-not $remove) {
foreach ($p in $hpTaskPathPatternsToRemove) {
if ($task.TaskPath -like $p) {
$remove = $true
break
}
}
}
if (-not $remove) { continue }
# protection: keep any Support Assistant tasks
$protected = $false
foreach ($p in $hpTaskProtectedPatterns) {
if ($task.TaskName -like $p -or $task.TaskPath -like "*Support Assistant*") {
$protected = $true
break
}
}
if ($protected) { continue }
Write-Host " Removing HP task: $($task.TaskPath)$($task.TaskName)"
try {
Unregister-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath -Confirm:$false
}
catch {
Write-Warning " Error removing task $($task.TaskPath)$($task.TaskName): $($_.Exception.Message)"
}
}
# 9.2 Recursively remove empty HP task folders
Write-Host "Cleaning up empty HP task folders…"
function Remove-EmptyTaskFolderRecursive {
param(
[Parameter(Mandatory)][string]$FolderPath,
[Parameter(Mandatory)]$Service
)
try {
$folder = $Service.GetFolder($FolderPath)
}
catch {
# folder does not exist -> nothing to do
return
}
# first process subfolders (bottom-up)
foreach ($sub in @($folder.GetFolders(0))) {
Remove-EmptyTaskFolderRecursive -FolderPath $sub.Path -Service $Service
}
# now check if this folder is empty
$hasTasks = ($folder.GetTasks(1).Count -gt 0)
$hasFolders = ($folder.GetFolders(1).Count -gt 0)
if (-not $hasTasks -and -not $hasFolders -and $FolderPath -ne "\") {
$parentPath = Split-Path $FolderPath
if ([string]::IsNullOrWhiteSpace($parentPath)) { $parentPath = "\" }
$name = Split-Path $FolderPath -Leaf
Write-Host " Removing empty folder: $FolderPath"
try {
$parent = $Service.GetFolder($parentPath)
$parent.DeleteFolder($name, 0)
}
catch {
Write-Warning " Error deleting folder $($FolderPath): $($_.Exception.Message)"
}
}
}
try {
$service = New-Object -ComObject "Schedule.Service"
$service.Connect()
# roots we want to clean up
foreach ($rootPath in @("\HP", "\Hewlett-Packard\HP Wolf Security")) {
Remove-EmptyTaskFolderRecursive -FolderPath $rootPath -Service $service
}
}
catch {
Write-Warning " Error accessing Task Scheduler (COM): $($_.Exception.Message)"
}
# --------------------------------------------------------------------
# 10) Remove leftover uninstall registry entries for
# HP Connection Optimizer & HP Documentation
# --------------------------------------------------------------------
Write-Host "Cleaning uninstall registry entries for HP Connection Optimizer / HP Documentation…"
$hpCleanupPatterns = @(
"*HP Connection Optimizer*",
"*HP Documentation*"
)
$uninstallRoots = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall",
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
)
foreach ($root in $uninstallRoots) {
Get-ChildItem -Path $root -ErrorAction SilentlyContinue | ForEach-Object {
try {
$props = Get-ItemProperty -Path $_.PSPath -ErrorAction SilentlyContinue
} catch { continue }
if (-not $props.DisplayName) { continue }
foreach ($pattern in $hpCleanupPatterns) {
if ($props.DisplayName -like $pattern) {
Write-Host " Deleting uninstall key: '$($props.DisplayName)'"
Write-Host " Path: $($_.PSPath)"
try {
Remove-Item -Path $_.PSPath -Recurse -Force -ErrorAction Stop
} catch {
Write-Warning " Error deleting uninstall key: $($_.Exception.Message)"
}
}
}
}
}
# --------------------------------------------------------------------
# 11) Remove start menu shortcuts (HP Documentation / Miro Offer / TCO Certified)
# --------------------------------------------------------------------
Write-Host "Cleaning start menu shortcuts…"
$shortcutNames = @(
"HP Documentation",
"Miro Offer",
"TCO Certified"
)
$programsPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"
foreach ($name in $shortcutNames) {
# find .lnk files with matching base name
$lnks = Get-ChildItem -Path $programsPath -Recurse -ErrorAction SilentlyContinue `
| Where-Object {
-not $_.PSIsContainer -and
$_.Extension -eq ".lnk" -and
$_.BaseName -like "$name*"
}
foreach ($lnk in $lnks) {
Write-Host " Removing shortcut: $($lnk.FullName)"
try {
Remove-Item -Path $lnk.FullName -Force -ErrorAction Stop
}
catch {
Write-Warning " Error deleting $($lnk.FullName): $($_.Exception.Message)"
}
}
# remove matching start menu folders if present
$dirs = Get-ChildItem -Path $programsPath -Recurse -Directory -ErrorAction SilentlyContinue `
| Where-Object { $_.Name -like "$name*" }
foreach ($dir in $dirs) {
Write-Host " Removing start menu folder: $($dir.FullName)"
try {
Remove-Item -Path $dir.FullName -Recurse -Force -ErrorAction Stop
}
catch {
Write-Warning " Error deleting folder $($dir.FullName): $($_.Exception.Message)"
}
}
}
# --------------------------------------------------------------------
# 12) Tag file for Intune detection rule
# --------------------------------------------------------------------
Write-Host "Creating Intune tag file…"
$tagFolder = "$env:ProgramData\Microsoft\RemoveHPBloatware"
$tagFile = Join-Path $tagFolder "hpbloatware_uninstall.ps1.tag"
if (-not (Test-Path $tagFolder)) {
New-Item -ItemType Directory -Path $tagFolder -Force | Out-Null
}
Set-Content -Path $tagFile -Value "Installed" -Force
Write-Host "Tag file: $tagFile"
Write-Host "===== HP cleanup finished ====="
Exit 0Based on the original script (thank you very much), I used GPT to customize a version for our environment and needs that works well. For anyone who is interested:
Short Summary
This script removes unwanted HP software, services, and scheduled tasks from HP Windows devices while keeping all components needed for Support Assistant and hardware diagnostics. It is designed for Intune deployment and includes a detection tag file.
🎯 What the Script Removes HP bloatware AppX packages (JumpStarts, QuickDrop, WorkWell, myHP, EasyClean, etc.)
Classic HP programs, including HP Wolf Security + components HP Sure Click / Sure Sense / Sure Run / Sure Recover HP Client Security Manager HP Notifications / Security Update Service / Default Settings HP MAC Address Manager Poly Lens HP Insights stack, including HP Insights (MSI) Insights Agent / WatchDog / Analytics / Audio Analytics HP Touchpoint Analytics Client HP Connection Optimizer (via correct silent InstallShield uninstall) HP Documentation (via HP's uninstall CMD)
Leftover Start Menu shortcuts (HP Documentation, Miro Offer, TCO Certified) Registry leftovers for Connection Optimizer & Documentation
🔥 HP Insights doesn’t come back The script removes every mechanism that HP uses to auto-reinstall Insights: HP Services Scan Insights Agent / Analytics / WatchDog services Scheduled tasks under \HP* and \Hewlett-Packard\HP Wolf Security* Empty HP task folders
This ensures Insights cannot return after removal.
🧩 What the Script Keeps To avoid breaking support workflows: HP Support Assistant HP PC Hardware Diagnostics All HSA Servises needed by Support Assistant HP Hotkey UWP Service HP LAN/WLAN/WWAN Switching UWP Service
These are required for diagnostics, Fn-keys, and network switching.
script, there you go
<# Remove HP Bloatware / HP Insights / Connection Optimizer / Documentation For Intune (detection via tag file) Keeps: - HP Support Assistant - HP PC Hardware Diagnostics Windows - all *HSA Service* services (App Helper / Diagnostics / Network / System Info) - HP Hotkey UWP Service - HP LAN/WLAN/WWAN Switching UWP Service #> [CmdletBinding()] param() $ErrorActionPreference = "Continue" Write-Host "===== Starting HP cleanup =====" # -------------------------------------------------------------------- # 0) Helper function: uninstall programs via registry Uninstall keys # (only used for Insights / Touchpoint, NOT for Support Assistant) # -------------------------------------------------------------------- function Invoke-RegistryUninstall { param( [string[]]$Patterns ) $roots = @( "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall", "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ) foreach ($root in $roots) { Get-ChildItem $root -ErrorAction SilentlyContinue | ForEach-Object { $props = Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue if (-not $props.DisplayName) { continue } foreach ($pattern in $Patterns) { if ($props.DisplayName -like $pattern) { # explicitly protected programs if ($props.DisplayName -like "*Support Assistant*" -or $props.DisplayName -like "*PC Hardware Diagnostics*") { continue } $name = $props.DisplayName $uninstallString = $props.UninstallString $key = $_.PSChildName Write-Host ">>> Registry uninstall for: $name" Write-Host " UninstallString: $uninstallString" try { # 1) MSI GUID as key name if ($key -match "^\{[0-9A-Fa-f\-]{36}\}$") { Start-Process "msiexec.exe" -ArgumentList "/X$key /qn /norestart" -Wait Write-Host " -> removed (GUID key)." continue } # 2) MSI via UninstallString if ($uninstallString -match "msiexec\.exe") { if ($uninstallString -match "\{[0-9A-Fa-f\-]{36}\}") { $guid = $Matches[0] Start-Process "msiexec.exe" -ArgumentList "/X$guid /qn /norestart" -Wait Write-Host " -> removed (GUID in string)." continue } } # 3) normal EXE setup if ($uninstallString) { if ($uninstallString.StartsWith('"')) { $exe = $uninstallString.Split('"')[1] $args = $uninstallString.Substring($exe.Length + 2).Trim() } else { $exe = $uninstallString.Split(" ")[0] $args = $uninstallString.Substring($exe.Length).Trim() } if ($args -notmatch "/quiet" -and $args -notmatch "/s") { $args += " /quiet /norestart" } Start-Process $exe -ArgumentList $args -Wait Write-Host " -> removed (EXE)." } } catch { Write-Warning " Error during uninstall: $($_.Exception.Message)" } } } } } } # -------------------------------------------------------------------- # 1) Remove AppX and provisioned packages (keep Support Assistant, HW Diagnostics) # -------------------------------------------------------------------- $UninstallPackages = @( "AD2F1837.HPJumpStarts" # "AD2F1837.HPPCHardwareDiagnosticsWindows" # AppX, desktop variant is kept "AD2F1837.HPPowerManager" "AD2F1837.HPPrivacySettings" # "AD2F1837.HPSupportAssistant" # if it must be kept "AD2F1837.HPSureShieldAI" "AD2F1837.HPSystemInformation" "AD2F1837.HPQuickDrop" "AD2F1837.HPWorkWell" "AD2F1837.myHP" "AD2F1837.HPDesktopSupportUtilities" "AD2F1837.HPQuickTouch" "AD2F1837.HPEasyClean" "AD2F1837.HPSystemInformation" "AD2F1837.11510256BE195" ) Write-Host "Removing HP AppX / provisioned packages…" $InstalledAppx = Get-AppxPackage -AllUsers | Where-Object { $UninstallPackages -contains $_.Name } $ProvAppx = Get-AppxProvisionedPackage -Online | Where-Object { $UninstallPackages -contains $_.DisplayName } foreach ($p in $ProvAppx) { Write-Host " Provisioned: $($p.DisplayName)" try { Remove-AppxProvisionedPackage -Online -PackageName $p.PackageName | Out-Null } catch {} } foreach ($p in $InstalledAppx) { Write-Host " AppX: $($p.Name)" try { Remove-AppxPackage -Package $p.PackageFullName -AllUsers | Out-Null } catch {} } # -------------------------------------------------------------------- # 2) Programs via Get-Package (HP Wolf, Sure*, etc.) # -------------------------------------------------------------------- Write-Host "Removing defined HP programs (Get-Package)…" $UninstallPrograms = @( "HP Client Security Manager" "HP Connection Optimizer" # additionally handled explicitly "HP Documentation" # additionally handled explicitly "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" "Poly Lens" "HP Insights" "HP Insights Agent" "HP Insights Analytics" "HP Insights WatchDog Service" "HP Touchpoint Analytics Client" ) $pattern = ($UninstallPrograms | ForEach-Object { [Regex]::Escape($_) }) -join "|" $InstalledPrograms = Get-Package -ErrorAction SilentlyContinue | Where-Object { $_.Name -match $pattern } foreach ($pkg in $InstalledPrograms) { Write-Host " Get-Package uninstall: $($pkg.Name)" try { $pkg | Uninstall-Package -AllVersions -Force -ErrorAction Stop | Out-Null } catch { Write-Warning " Error: $($_.Exception.Message)" } } # -------------------------------------------------------------------- # 3) Fallback via Win32_Product (slow, but okay one-time) # -------------------------------------------------------------------- Write-Host "Searching additional HP programs via Win32_Product…" $appList = Get-WmiObject -Class Win32_Product -ErrorAction SilentlyContinue | Where-Object { ($_.Name -like '*HP Wolf Security*') -or ($_.Name -like '*Poly Lens*') -or ($_.Name -like '*HP Sure Recover*') -or ($_.Name -match 'ICS') -or ($_.Name -like '*HP Security Update Service*') -or ($_.Name -like '*HP Notifications*') -or ($_.Name -like '*HP Connection Optimizer*') -or ($_.Name -like '*HP Documentation*') -or ($_.Name -like '*HP Insights*') -or ($_.Name -like '*HP Touchpoint Analytics*') } foreach ($app in $appList) { Write-Host " Win32_Product uninstall: $($app.Name)" try { $null = $app.Uninstall() } catch { Write-Warning " Error: $($_.Exception.Message)" } } # -------------------------------------------------------------------- # 4) MSI fallbacks (Wolf Security & old Connection Optimizer GUID) # -------------------------------------------------------------------- Write-Host "Running MSI fallback uninstallers…" $wolfGuids = @( "{0E2E04B0-9EDD-11EB-B38C-10604B96B11E}", "{4DA839F0-72CF-11EC-B247-3863BB3CB5A8}" ) foreach ($guid in $wolfGuids) { try { Start-Process "msiexec.exe" -ArgumentList "/X$guid /qn /norestart" -Wait -ErrorAction Stop Write-Host " Wolf Security GUID removed: $guid" } catch {} } try { # if this old MSI version is present Start-Process "msiexec.exe" -ArgumentList "/X{FCC74B77-EC3E-4DD8-A80B-008A702075A9} /qn /norestart" -Wait -ErrorAction SilentlyContinue Write-Host " HP Connection Optimizer (MSI GUID) removed (if present)." } catch {} # -------------------------------------------------------------------- # 5) HP Connection Optimizer – exact InstallShield uninstall # -------------------------------------------------------------------- Write-Host "HP Connection Optimizer (InstallShield)…" $coExe = "C:\Program Files (x86)\InstallShield Installation Information\{6468C4A5-E47E-405F-B675-A70A70983EA6}\setup.exe" if (Test-Path $coExe) { try { $args = "-runfromtemp -l0x0407 -removeonly /s" Write-Host " -> $coExe $args" Start-Process $coExe -ArgumentList $args -Wait -ErrorAction Stop Write-Host " -> HP Connection Optimizer uninstalled." } catch { Write-Warning " -> Error uninstalling HP Connection Optimizer: $($_.Exception.Message)" } } else { Write-Host " HP Connection Optimizer setup.exe not found – maybe already removed." } # -------------------------------------------------------------------- # 6) HP Documentation – exact CMD uninstall # -------------------------------------------------------------------- Write-Host "HP Documentation…" $docCmd = "C:\Program Files\HP\Documentation\Doc_Uninstall.cmd" if (Test-Path $docCmd) { try { Start-Process "cmd.exe" -ArgumentList "/c `"$docCmd`"" -Wait -ErrorAction Stop Write-Host " -> HP Documentation uninstalled." } catch { Write-Warning " -> Error uninstalling HP Documentation: $($_.Exception.Message)" } } else { Write-Host " HP Documentation not found – maybe already removed." } # -------------------------------------------------------------------- # 7) HP Insights – proper MSI uninstall (instead of /I) # -------------------------------------------------------------------- Write-Host "HP Insights (MSI)…" $insightsGuid = "{B1C44EC2-0AB5-4777-9EAF-532196758090}" try { Start-Process "msiexec.exe" -ArgumentList "/X$insightsGuid /qn /norestart" -Wait -ErrorAction Stop Write-Host " -> HP Insights uninstalled." } catch { Write-Warning " -> Error uninstalling HP Insights: $($_.Exception.Message)" } # additionally try to catch other Insights / Touchpoint variants Invoke-RegistryUninstall -Patterns @( "*HP Insights*", "*HP Touchpoint Analytics*" ) # -------------------------------------------------------------------- # 8) Remove HP Insights / Analytics / auto-installer services # (Support Assistant & all *HSA Service* are kept!) # -------------------------------------------------------------------- Write-Host "Cleaning up HP Insights-related services…" # 8.1 Exact, safe service names: $hpInsightsServiceNames = @( "HP Services Scan", "HP Insights Agent", "HP Insights WatchDog Service", "HP Audio Analytics Service" ) foreach ($svcName in $hpInsightsServiceNames) { $svc = Get-Service -Name $svcName -ErrorAction SilentlyContinue if ($null -ne $svc) { Write-Host " Exact: stopping and deleting $($svc.DisplayName)" try { if ($svc.Status -ne "Stopped") { Stop-Service -Name $svc.Name -Force -ErrorAction SilentlyContinue } sc.exe delete "$($svc.Name)" | Out-Null } catch { Write-Warning " Error removing service $($svc.DisplayName): $($_.Exception.Message)" } } } # 8.2 Pattern-based cleanup (without touching HSA / hotkey / switching services) $hpSvcPatterns = @( "*Insights*", "*Touchpoint*", "*Audio Analytics*" ) $protectedPatterns = @( "*HSA Service*", # keep all HSA services "*Support Assistant*", # in case of a dedicated service "*Hotkey UWP Service*", "*LAN/WLAN/WWAN Switching UWP Service*" ) foreach ($svc in Get-Service -ErrorAction SilentlyContinue) { $name = $svc.DisplayName if (-not $name) { continue } # protection: services that must never be removed $isProtected = $false foreach ($pp in $protectedPatterns) { if ($name -like $pp) { $isProtected = $true break } } if ($isProtected) { continue } foreach ($pat in $hpSvcPatterns) { if ($name -like $pat) { Write-Host " Pattern: stopping and deleting $name" try { if ($svc.Status -ne "Stopped") { Stop-Service -Name $svc.Name -Force -ErrorAction SilentlyContinue } sc.exe delete "$($svc.Name)" | Out-Null } catch { Write-Warning " Error removing service $($name): $($_.Exception.Message)" } break } } } # -------------------------------------------------------------------- # 9) Clean up HP scheduled tasks # - remove unwanted HP tasks # - remove empty HP task folders # -------------------------------------------------------------------- Write-Host "Cleaning up HP scheduled tasks…" # Which task names should be removed? $hpTaskNamePatternsToRemove = @( "*HP Insights*", "*Touchpoint*", "*Analytics*", "Consent Manager Launcher" ) # Which task paths should be cleaned up? $hpTaskPathPatternsToRemove = @( "\HP\*", "\Hewlett-Packard\HP Wolf Security\*" ) # Which tasks/folders must be kept? $hpTaskProtectedPatterns = @( "*Support Assistant*" ) # 9.1 Remove tasks $allTasks = Get-ScheduledTask -ErrorAction SilentlyContinue foreach ($task in $allTasks) { $remove = $false # match by task name foreach ($p in $hpTaskNamePatternsToRemove) { if ($task.TaskName -like $p) { $remove = $true break } } # match by task path (if not already decided) if (-not $remove) { foreach ($p in $hpTaskPathPatternsToRemove) { if ($task.TaskPath -like $p) { $remove = $true break } } } if (-not $remove) { continue } # protection: keep any Support Assistant tasks $protected = $false foreach ($p in $hpTaskProtectedPatterns) { if ($task.TaskName -like $p -or $task.TaskPath -like "*Support Assistant*") { $protected = $true break } } if ($protected) { continue } Write-Host " Removing HP task: $($task.TaskPath)$($task.TaskName)" try { Unregister-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath -Confirm:$false } catch { Write-Warning " Error removing task $($task.TaskPath)$($task.TaskName): $($_.Exception.Message)" } } # 9.2 Recursively remove empty HP task folders Write-Host "Cleaning up empty HP task folders…" function Remove-EmptyTaskFolderRecursive { param( [Parameter(Mandatory)][string]$FolderPath, [Parameter(Mandatory)]$Service ) try { $folder = $Service.GetFolder($FolderPath) } catch { # folder does not exist -> nothing to do return } # first process subfolders (bottom-up) foreach ($sub in @($folder.GetFolders(0))) { Remove-EmptyTaskFolderRecursive -FolderPath $sub.Path -Service $Service } # now check if this folder is empty $hasTasks = ($folder.GetTasks(1).Count -gt 0) $hasFolders = ($folder.GetFolders(1).Count -gt 0) if (-not $hasTasks -and -not $hasFolders -and $FolderPath -ne "\") { $parentPath = Split-Path $FolderPath if ([string]::IsNullOrWhiteSpace($parentPath)) { $parentPath = "\" } $name = Split-Path $FolderPath -Leaf Write-Host " Removing empty folder: $FolderPath" try { $parent = $Service.GetFolder($parentPath) $parent.DeleteFolder($name, 0) } catch { Write-Warning " Error deleting folder $($FolderPath): $($_.Exception.Message)" } } } try { $service = New-Object -ComObject "Schedule.Service" $service.Connect() # roots we want to clean up foreach ($rootPath in @("\HP", "\Hewlett-Packard\HP Wolf Security")) { Remove-EmptyTaskFolderRecursive -FolderPath $rootPath -Service $service } } catch { Write-Warning " Error accessing Task Scheduler (COM): $($_.Exception.Message)" } # -------------------------------------------------------------------- # 10) Remove leftover uninstall registry entries for # HP Connection Optimizer & HP Documentation # -------------------------------------------------------------------- Write-Host "Cleaning uninstall registry entries for HP Connection Optimizer / HP Documentation…" $hpCleanupPatterns = @( "*HP Connection Optimizer*", "*HP Documentation*" ) $uninstallRoots = @( "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall", "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ) foreach ($root in $uninstallRoots) { Get-ChildItem -Path $root -ErrorAction SilentlyContinue | ForEach-Object { try { $props = Get-ItemProperty -Path $_.PSPath -ErrorAction SilentlyContinue } catch { continue } if (-not $props.DisplayName) { continue } foreach ($pattern in $hpCleanupPatterns) { if ($props.DisplayName -like $pattern) { Write-Host " Deleting uninstall key: '$($props.DisplayName)'" Write-Host " Path: $($_.PSPath)" try { Remove-Item -Path $_.PSPath -Recurse -Force -ErrorAction Stop } catch { Write-Warning " Error deleting uninstall key: $($_.Exception.Message)" } } } } } # -------------------------------------------------------------------- # 11) Remove start menu shortcuts (HP Documentation / Miro Offer / TCO Certified) # -------------------------------------------------------------------- Write-Host "Cleaning start menu shortcuts…" $shortcutNames = @( "HP Documentation", "Miro Offer", "TCO Certified" ) $programsPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs" foreach ($name in $shortcutNames) { # find .lnk files with matching base name $lnks = Get-ChildItem -Path $programsPath -Recurse -ErrorAction SilentlyContinue ` | Where-Object { -not $_.PSIsContainer -and $_.Extension -eq ".lnk" -and $_.BaseName -like "$name*" } foreach ($lnk in $lnks) { Write-Host " Removing shortcut: $($lnk.FullName)" try { Remove-Item -Path $lnk.FullName -Force -ErrorAction Stop } catch { Write-Warning " Error deleting $($lnk.FullName): $($_.Exception.Message)" } } # remove matching start menu folders if present $dirs = Get-ChildItem -Path $programsPath -Recurse -Directory -ErrorAction SilentlyContinue ` | Where-Object { $_.Name -like "$name*" } foreach ($dir in $dirs) { Write-Host " Removing start menu folder: $($dir.FullName)" try { Remove-Item -Path $dir.FullName -Recurse -Force -ErrorAction Stop } catch { Write-Warning " Error deleting folder $($dir.FullName): $($_.Exception.Message)" } } } # -------------------------------------------------------------------- # 12) Tag file for Intune detection rule # -------------------------------------------------------------------- Write-Host "Creating Intune tag file…" $tagFolder = "$env:ProgramData\Microsoft\RemoveHPBloatware" $tagFile = Join-Path $tagFolder "hpbloatware_uninstall.ps1.tag" if (-not (Test-Path $tagFolder)) { New-Item -ItemType Directory -Path $tagFolder -Force | Out-Null } Set-Content -Path $tagFile -Value "Installed" -Force Write-Host "Tag file: $tagFile" Write-Host "===== HP cleanup finished =====" Exit 0
Thanks a lot! 🙏

We recently onboarded a new client who have some windows 8 era HP AIOs and found a few more applications and packages that weren't accounted for in the current iteration. This script seems more targeted to new HP deployments, but is equally useful for old deployments that still have the bloat present.
I have not run the script yet with the modifications, but here's our current list. I realize this is for HP bloatware, but I've included Mcafee, wildtangent, and candy crush as well.