Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active May 1, 2026 12:42
Show Gist options
  • Select an option

  • Save mark05e/a79221b4245962a477a49eb281d97388 to your computer and use it in GitHub Desktop.

Select an option

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."}
# }
@HapaxOromenon
Copy link
Copy Markdown

How do I download and run bits of code I find like this on GitHub? Don't give me that "you need years of school" nonsense, because it's never that complicated. i thought i just needed to open this in PowerShell, but that either immediately crashed or did nothing. I'm on an up-to-date Windows 11 hp pavilion from about 4 or 5 years ago.

This may well be a PowerShell execution policy problem - by default, Windows only lets you type commands into the PowerShell console and doesn't let you run scripts. So to change this, right-click on PowerShell on the start menu and select "Run as Administrator". In the console that opens, type in "Set-ExecutionPolicy Unrestricted" (without the quotation marks) and press enter. It'll ask you whether you want to confirm - now type in a capital A (shift-A) and then press enter. After that, it should display some text confirming that your execution policy has been changed, and (assuming it was indeed successful) you can close the PowerShell console now. You should then be able to just copy and paste PowerShell code into Notepad, save it as a file with the ps1 extension (e.g. script.ps1 - making sure to select the "Save as type" as "All files" in order to not add the default .txt extension), and then right-click the file and "Run with PowerShell".

For scripts such as this one, you'll probably also need to run PowerShell as administrator; an easy way to do that when you're using a script is to just include the following line of code at the top of the script (i.e. copy-and-paste it into Notepad and press Enter to go to a new line, before then pasting in the rest of the script):
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath"" -Verb RunAs; exit }

Lastly, if the scripts people have posted above give errors, you can also try the ones found at https://gist.github.com/ll4mat/c1bbe8dc096a207680df29931cffed21 and https://github.com/andrew-s-taylor/public/raw/refs/heads/main/De-Bloat/RemoveBloat.zip (for this latter one, you just extract the zip file to get the ps1 file, and just change your execution policy as explained above, then right-click RemoveBloat.ps1 and Run with PowerShell. You won't need to modify the code, as the author has already included a line similar to that above to force PowerShell to run as administrator).

@creatcatsby
Copy link
Copy Markdown

creatcatsby commented Mar 27, 2026

I got some Errors of the last script from plao commented on Dec 10, 2025

•C:\Install>powershell.exe -ExecutionPolicy Bypass -File uninstall.ps1

At C:\Install\uninstall.ps1:274 char:8

  • } else {
  •    ~
    

Missing closing "}" in statement block or type definition.

At C:\Install\uninstall.ps1:255 char:8

  • } else {
  •    ~
    

Missing closing "}" in statement block or type definition.

+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace

Hey, I had the same issue on my side. It turned out to be an encoding problem.

Try opening the script in Notepad++, then check the encoding at the bottom right. Click on it and choose:
“Save with Encoding” → “UTF-8 with BOM”

save the script with this encoding. That should fix the error and weird character displayed in PowerShell.

@plao
Copy link
Copy Markdown

plao commented Mar 27, 2026

I got some Errors of the last script from plao commented on Dec 10, 2025
•C:\Install>powershell.exe -ExecutionPolicy Bypass -File uninstall.ps1
At C:\Install\uninstall.ps1:274 char:8

  • } else {
  •    ~
    

Missing closing "}" in statement block or type definition.
At C:\Install\uninstall.ps1:255 char:8

  • } else {
  •    ~
    

Missing closing "}" in statement block or type definition.

+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace

Hey, I had the same issue on my side. It turned out to be an encoding problem.

Try opening the script in Notepad++, then check the encoding at the bottom right. Click on it and choose: “Save with Encoding” → “UTF-8 with BOM”

save the script with this encoding. That should fix the error and weird character displayed in PowerShell.

Fine, thanks!

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