-
-
Save mark05e/2db81671f39a041a5992a64a77748dc7 to your computer and use it in GitHub Desktop.
# ██████╗ ███████╗███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ██╗██████╗ | |
# ██╔══██╗██╔════╝████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ██║██╔══██╗ | |
# ██████╔╝█████╗ ██╔████╔██║██║ ██║██║ ██║█████╗ ███████║██████╔╝ | |
# ██╔══██╗██╔══╝ ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██║██╔═══╝ | |
# ██║ ██║███████╗██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██║ ██║██║ | |
# ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ | |
# | |
# ██████╗ ██╗ ██████╗ █████╗ ████████╗██╗ ██╗ █████╗ ██████╗ ███████╗ | |
# ██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔════╝ | |
# ██████╔╝██║ ██║ ██║███████║ ██║ ██║ █╗ ██║███████║██████╔╝█████╗ | |
# ██╔══██╗██║ ██║ ██║██╔══██║ ██║ ██║███╗██║██╔══██║██╔══██╗██╔══╝ | |
# ██████╔╝███████╗╚██████╔╝██║ ██║ ██║ ╚███╔███╔╝██║ ██║██║ ██║███████╗ | |
# ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | |
# | |
# ██████╗ ███████╗████████╗ █████╗ | |
# ██╔══██╗██╔════╝╚══██╔══╝██╔══██╗ | |
# ██████╔╝█████╗ ██║ ███████║ | |
# ██╔══██╗██╔══╝ ██║ ██╔══██║ | |
# ██████╔╝███████╗ ██║ ██║ ██║ | |
# ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ | |
# | |
# Remove HP bloatware / crapware - BETA version | |
# | |
# -- source : https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388 | |
# -- contrib: francishagyard2, mark05E, erottier, JoachimBerghmans, sikkepitje, Ithendyr | |
# -- note : this script could use your improvements. contributions welcome! | |
# List of built-in apps to remove | |
$UninstallPackages = @( | |
"AD2F1837.HPJumpStarts" | |
"AD2F1837.HPPCHardwareDiagnosticsWindows" | |
"AD2F1837.HPPowerManager" | |
"AD2F1837.HPPrivacySettings" | |
"AD2F1837.HPSupportAssistant" | |
"AD2F1837.HPSureShieldAI" | |
"AD2F1837.HPSystemInformation" | |
"AD2F1837.HPQuickDrop" | |
"AD2F1837.HPWorkWell" | |
"AD2F1837.myHP" | |
"AD2F1837.HPDesktopSupportUtilities" | |
"AD2F1837.HPQuickTouch" | |
"AD2F1837.HPEasyClean" | |
"AD2F1837.HPSystemInformation" | |
) | |
# List of programs to uninstall | |
$UninstallPrograms = @( | |
"HP Device Access Manager" | |
"HP Client Security Manager" | |
"HP Connection Optimizer" | |
"HP Documentation" | |
"HP MAC Address Manager" | |
"HP Notifications" | |
"HP System Info HSA Service" | |
"HP Security Update Service" | |
"HP System Default Settings" | |
"HP Sure Click" | |
"HP Sure Click Security Browser" | |
"HP Sure Run" | |
"HP Sure Run Module" | |
"HP Sure Recover" | |
"HP Sure Sense" | |
"HP Sure Sense Installer" | |
"HP Wolf Security" | |
"HP Wolf Security - Console" | |
"HP Wolf Security Application Support for Sure Sense" | |
"HP Wolf Security Application Support for Windows" | |
) | |
$HPidentifier = "AD2F1837" | |
$InstalledPackages = Get-AppxPackage -AllUsers ` | |
| Where-Object {($UninstallPackages -contains $_.Name) -or ($_.Name -match "^$HPidentifier")} | |
$ProvisionedPackages = Get-AppxProvisionedPackage -Online ` | |
| Where-Object {($UninstallPackages -contains $_.DisplayName) -or ($_.DisplayName -match "^$HPidentifier")} | |
$InstalledPrograms = Get-Package | Where-Object {$UninstallPrograms -contains $_.Name} | |
# Stop HP Services | |
Function StopDisableService($name) { | |
if (Get-Service -Name $name -ea SilentlyContinue) { | |
Stop-Service -Name $name -Force -Confirm:$False | |
Set-Service -Name $name -StartupType Disabled | |
} | |
} | |
StopDisableService -name "HotKeyServiceUWP" | |
StopDisableService -name "HPAppHelperCap" | |
StopDisableService -name "HP Comm Recover" | |
StopDisableService -name "HPDiagsCap" | |
StopDisableService -name "HotKeyServiceUWP" | |
StopDisableService -name "LanWlanWwanSwitchgingServiceUWP" # do we need to stop this? | |
StopDisableService -name "HPNetworkCap" | |
StopDisableService -name "HPSysInfoCap" | |
StopDisableService -name "HP TechPulse Core" | |
# Remove installed programs | |
$InstalledPrograms | ForEach-Object { | |
Write-Host -Object "Attempting to uninstall: [$($_.Name)]..." | |
Try { | |
$Null = $_ | Uninstall-Package -AllVersions -Force -ErrorAction Stop | |
Write-Host -Object "Successfully uninstalled: [$($_.Name)]" | |
} | |
Catch { | |
Write-Warning -Message "Failed to uninstall: [$($_.Name)]" | |
Write-Host -Object "Attempting to uninstall as MSI package: [$($_.Name)]..." | |
Try { | |
$product = Get-WmiObject win32_product | where { $_.name -like "$($_.Name)" } | |
if ($_ -ne $null) { | |
msiexec /x $product.IdentifyingNumber /quiet /noreboot | |
} | |
else { Write-Warning -Message "Can't find MSI package: [$($_.Name)]" } | |
} | |
Catch { Write-Warning -Message "Failed to uninstall MSI package: [$($_.Name)]" } | |
} | |
} | |
# Fallback attempt 1 to remove HP Wolf Security using msiexec | |
Try { | |
MsiExec /x "{0E2E04B0-9EDD-11EB-B38C-10604B96B11E}" /qn /norestart | |
Write-Host -Object "Fallback to MSI uninistall for HP Wolf Security initiated" | |
} | |
Catch { | |
Write-Warning -Object "Failed to uninstall HP Wolf Security using MSI - Error message: $($_.Exception.Message)" | |
} | |
# Fallback attempt 2 to remove HP Wolf Security using msiexec | |
Try { | |
MsiExec /x "{4DA839F0-72CF-11EC-B247-3863BB3CB5A8}" /qn /norestart | |
Write-Host -Object "Fallback to MSI uninistall for HP Wolf 2 Security initiated" | |
} | |
Catch { | |
Write-Warning -Object "Failed to uninstall HP Wolf Security 2 using MSI - Error message: $($_.Exception.Message)" | |
} | |
# Remove appx provisioned packages - AppxProvisionedPackage | |
ForEach ($ProvPackage in $ProvisionedPackages) { | |
Write-Host -Object "Attempting to remove provisioned package: [$($ProvPackage.DisplayName)]..." | |
Try { | |
$Null = Remove-AppxProvisionedPackage -PackageName $ProvPackage.PackageName -Online -ErrorAction Stop | |
Write-Host -Object "Successfully removed provisioned package: [$($ProvPackage.DisplayName)]" | |
} | |
Catch {Write-Warning -Message "Failed to remove provisioned package: [$($ProvPackage.DisplayName)]"} | |
} | |
# Remove appx packages - AppxPackage | |
ForEach ($AppxPackage in $InstalledPackages) { | |
Write-Host -Object "Attempting to remove Appx package: [$($AppxPackage.Name)]..." | |
Try { | |
$Null = Remove-AppxPackage -Package $AppxPackage.PackageFullName -AllUsers -ErrorAction Stop | |
Write-Host -Object "Successfully removed Appx package: [$($AppxPackage.Name)]" | |
} | |
Catch {Write-Warning -Message "Failed to remove Appx package: [$($AppxPackage.Name)]"} | |
} | |
# # Uncomment this section to see what is left behind | |
# Write-Host "Checking stuff after running script" | |
# Write-Host "For Get-AppxPackage -AllUsers" | |
# Get-AppxPackage -AllUsers | where {$_.Name -like "*HP*"} | |
# Write-Host "For Get-AppxProvisionedPackage -Online" | |
# Get-AppxProvisionedPackage -Online | where {$_.DisplayName -like "*HP*"} | |
# Write-Host "For Get-Package" | |
# Get-Package | select Name, FastPackageReference, ProviderName, Summary | Where {$_.Name -like "*HP*"} | Format-List | |
# # Feature - Ask for reboot after running the script | |
# $input = Read-Host "Restart computer now [y/n]" | |
# switch($input){ | |
# y{Restart-computer -Force -Confirm:$false} | |
# n{exit} | |
# default{write-warning "Skipping reboot."} | |
# } |
Hi @xxIPREDATORIxx, I placed my own version here: https://github.com/IntuneSpecialist/Intune/tree/main/Powershell%20scripts. Its the same version as I mentioned above but since they never responded I descided to place my own version there.
thanks will give these suggestions a try, really appreciate the help
Hi @xxIPREDATORIxx, I placed my own version here: https://github.com/IntuneSpecialist/Intune/tree/main/Powershell%20scripts. Its the same version as I mentioned above but since they never responded I descided to place my own version there.
I had some problems on some PCs after running this script
This is the result of the script:
Successfully uninstalled: [HP System Default Settings]
AVVISO: Failed to uninstall: []
Successfully uninstalled: [HP Wolf Security]
Successfully uninstalled: [HP Wolf Security - Console]
HP Documentation is not installed
HP Support Assistant regkey not found
Successfully removed provisioned package: HP Support Assistant silently
Get-WmiObject : Errore generico
In riga:245 car:13
+ $apps = Get-WmiObject -Class Win32_Product | Where-Object {$_.Nam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Upon reboot, the user could not be logged back in.
have you had other cases?
@Leonarduk00 that is very strange, I run it on 100+ machines without any problems. What kind of error does the user get when the user tries to login?
@foeyonghai Nothing !!! Either the system goes to a black screen, or it remains in the initial loading, blue screen and sometimes I can log in and in the system events there are countless errors. The PC has Windows 10 Pro and it has been operational for a few years, I wouldn't want it to be a problem with HP or system software updates.
The few times I manage to log in if I try to start the Windows 11 update it gives me an error 0x80070002
The event log is:
Nome dell'applicazione che ha generato l'errore: dwm.exe, versione: 10.0.19041.4355, timestamp: 0x6564cf4e
Nome del modulo che ha generato l'errore: KERNELBASE.dll, versione: 10.0.19041.4355, timestamp: 0xd7762934
Codice eccezione: 0xe0464645
Offset errore 0x000000000012d332
ID processo che ha generato l'errore: 0x1e78
Ora di avvio dell'applicazione che ha generato l'errore: 0x01daa6b0cd82e596
Percorso dell'applicazione che ha generato l'errore: C:\windows\system32\dwm.exe
Percorso del modulo che ha generato l'errore: C:\windows\System32\KERNELBASE.dll
ID segnalazione: 88fea123-c1da-498d-b8d6-6c31dc6f3bed
Nome completo pacchetto che ha generato l'errore:
I think the profile was compromised as described in this post:
https://gist.github.com/mark05e/2db81671f39a041a5992a64a77748dc7?permalink_comment_id=4860762#gistcomment-4860762
@Leonarduk00, did you run this with user permissions or admin permissions? I deployed this script always with SYSTEM permissions by Intune. Need to admit that I never tested or used it with user permissions. If is ran as a user I think that this could(must) be blocked in the script.
Yet another "i'm here as a regular user, i tried the one from the original git and my PC's still freezing regularly, is there a latest script that I won't be running with Intune" post. I really want everything HP stripped away from my Z2's and I'm wondering what is the best version of the script to run.
Also along with all this BS, did you guys notice that out of the box, there's a Defender blanket exclusion for the entire HP folder that's not user-deleteable? Absolute fricken madness. I'm definitely returning to Lenovo for my next workstations - I wanted off a Chinese based company, and this is how a US based one treats me. Insane.
Hi @xxIPREDATORIxx, I placed my own version here: https://github.com/IntuneSpecialist/Intune/tree/main/Powershell%20scripts. Its the same version as I mentioned above but since they never responded I descided to place my own version there.
Thanks for that, its working quite well. I'm having a problem with it trying to uninstall HP Security Update Service before Wolf Security - Console which is causing it to not uninstall on first run
Hello can you please add these to the list, they run as a local account and keep coming back
- HP App Helper HSA Service
- HP Network HSA Service
- HP System Info HSA Service
- HP Analytics Service
Got to say, this is the most frustrating refresh rollout I've ever had, I've tried some of these scripts thus far, but got to say, the wolf security side of things is the worst :(
@foeyonghai did you run the script via intune remediations or just a basic script?
Hello can you please add these to the list, they run as a local account and keep coming back
* [ ] HP App Helper HSA Service * [ ] **HP Network HSA Service** * [ ] HP System Info HSA Service * [ ] HP Analytics Service
Hi @weedkiller, will look at it, you'll hear from me.
@foeyonghai did you run the script via intune remediations or just a basic script?
Hi! @funk0id
I run this as a Powershell script in Intune with the settings below. I think I need to clarify some of these details, good question from your side.
PowerShell script
DeleteHPBloatware.ps1
Run this script using the logged on credentials
No
Enforce script signature check
No
Run script in 64 bit PowerShell Host
Yes
I managed to get it going with remediations too thanks @foeyonghai and others that have contributed.
I've not done a manual run of it to see what's going on but I've still ended up with the following remaining in add remove programs and services...
Add remove programs...
HP Connection Optimizer
HP Documentation
Z by HP Data Science Stack Manager 1.5.3
Services...
HP App Helper HSA Service
HP Comm Recovery
HP Diagnostics and HSA Service
HP Hotkey UWP Service
HP Insights Analytics
HP LAN/WLAN.WWAN Switching UWP Service
HP Network HSA Service
HP SFU Service
HP System info HSA Service
(Edit - Note this is with a fresh batch of G11 devices that shipped a couple of weeks ago)
(Edit 2 - I've just added the Z by HP one to the list too, hadn't noticed that)
Hi @funk0id, thank you for the information! Is it W10 of W11 by the way? I think it shouldn't really matter but just to be sure. Maybe I can search on the internet for an image for those machines and see what happens.
Services...
Try this. They're installed as drivers apparently
# List of service names
$services = @(
"HpTouchpointAnalyticsService",
"HPSysInfoCap",
"HPOmenCap",
"HPOmenCap",
"HPDiagsCap",
"HPAppHelperCap",
"HPNetworkCap"
)
foreach ($service in $services) {
try {
# Check if the service exists
$serviceExists = Get-Service -Name $service -ErrorAction SilentlyContinue
if ($serviceExists) {
# Stop the service
Write-Host "Stopping service: $service"
Stop-Service -Name $service -ErrorAction Stop
# Set service startup type to Disabled
Write-Host "Disabling service: $service"
Set-Service -Name $service -StartupType Disabled -ErrorAction Stop
# Delete the service using sc.exe
Write-Host "Deleting service: $service"
& sc.exe delete $service
}
else {
Write-Host "Service $service does not exist. Skipping..."
}
}
catch {
Write-Host "Error occurred with service: $service. Error: $_"
}
}
Write-Host "Operation completed."
Hi @funk0id, thank you for the information! Is it W10 of W11 by the way? I think it shouldn't really matter but just to be sure. Maybe I can search on the internet for an image for those machines and see what happens.
W11
this is the most miserable i've felt fixing a computer problem before like 3 things pop up i need to do before i progress
can someone explain how to get this working current day in one message?
i'm super overwhelmed and paranoid of breaking my computer
I agree, this is an absolute mess and not usable.
can someone explain how to get this working current day in one message? i'm super overwhelmed and paranoid of breaking my computer
I agree, this is an absolute mess and not usable.
where are you guys failing? I run this code (or at least something based on it) from intunes on all my managed devices (+100) and our users don't even know it's happening
The only part that keeps breaking after a while for me is the stupid HP Wolf Security software
Well, I see comments from 2022, how do I know if the script in the first post is golden?
eg. The comment from 13th september isn't incorporated in the first post.
most of the original script is just about uninstalling a "store app" or "msi"
The list of apps that's available in the first post is what you will need to check/adapt/update
(for ex. I added some additional microsoft apps to the list)
A lot of the replies i see here, are additions to the original script.
Or are related to specific issues users have encountered.
(i did not scroll trough the entire history)
Hi @mark05e,
thank you for the great starting point - I've forked and quite heavily modified your script to accommodate additional use cases in enterprise environments.
Key extensions I made:
- Added granular parameterization for selective removal (e.g. -RemoveHotKeyService, -RemoveOtherServices, -RemoveM365Apps, etc.)
- Implemented full DryRun support
- Added / Reworked Microsoft 365 removal logic using ODT (setup.exe + UninstallOffice.xml) with fallback for OneNoteFreeRetail via OfficeClickToRun.exe
- Added registry-based cleanup for leftover Click-to-Run apps
- Modularized everything into dedicated functions for easier maintenance
- Extended documentation and logging (incl. usage examples, parameter help, error handling)
My updated version is available here if others find it useful:
https://gist.github.com/ll4mat/c1bbe8dc096a207680df29931cffed21
Thanks again to all contributors for your solid groundwork - it saved me a lot of time!
Hi @mark05e,
thank you for the great starting point - I've forked and quite heavily modified your script to accommodate additional use cases in enterprise environments.
Key extensions I made:
- Added granular parameterization for selective removal (e.g. -RemoveHotKeyService, -RemoveOtherServices, -RemoveM365Apps, etc.)
- Implemented full DryRun support
- Added / Reworked Microsoft 365 removal logic using ODT (setup.exe + UninstallOffice.xml) with fallback for OneNoteFreeRetail via OfficeClickToRun.exe
- Added registry-based cleanup for leftover Click-to-Run apps
- Modularized everything into dedicated functions for easier maintenance
- Extended documentation and logging (incl. usage examples, parameter help, error handling)
My updated version is available here if others find it useful: https://gist.github.com/ll4mat/c1bbe8dc096a207680df29931cffed21
Thanks again to all contributors for your solid groundwork - it saved me a lot of time!
I tried it during Autopilot, it didn't remove anything. It prompted for incorrect usage of MSI pop up and carried on. All HP stuff are still present.

Hi @mark05e,
thank you for the great starting point - I've forked and quite heavily modified your script to accommodate additional use cases in enterprise environments.
Key extensions I made:
- Added granular parameterization for selective removal (e.g. -RemoveHotKeyService, -RemoveOtherServices, -RemoveM365Apps, etc.)
- Implemented full DryRun support
- Added / Reworked Microsoft 365 removal logic using ODT (setup.exe + UninstallOffice.xml) with fallback for OneNoteFreeRetail via OfficeClickToRun.exe
- Added registry-based cleanup for leftover Click-to-Run apps
- Modularized everything into dedicated functions for easier maintenance
- Extended documentation and logging (incl. usage examples, parameter help, error handling)
My updated version is available here if others find it useful: https://gist.github.com/ll4mat/c1bbe8dc096a207680df29931cffed21
Thanks again to all contributors for your solid groundwork - it saved me a lot of time!I tried it during Autopilot, it didn't remove anything. It prompted for incorrect usage of MSI pop up and carried on. All HP stuff are still present.
![]()
Same thing here. Did you find a solution?
@mark05e @mark05e getting this MSI pop up during uninstallation - there is no logging, so I can't see what's happening.
Same thing as well, I never managed to remove HP Wolf with this script because of the always changing GUIDs
Hi @mark05e,
thank you for the great starting point - I've forked and quite heavily modified your script to accommodate additional use cases in enterprise environments.
Key extensions I made:
- Added granular parameterization for selective removal (e.g. -RemoveHotKeyService, -RemoveOtherServices, -RemoveM365Apps, etc.)
- Implemented full DryRun support
- Added / Reworked Microsoft 365 removal logic using ODT (setup.exe + UninstallOffice.xml) with fallback for OneNoteFreeRetail via OfficeClickToRun.exe
- Added registry-based cleanup for leftover Click-to-Run apps
- Modularized everything into dedicated functions for easier maintenance
- Extended documentation and logging (incl. usage examples, parameter help, error handling)
My updated version is available here if others find it useful: https://gist.github.com/ll4mat/c1bbe8dc096a207680df29931cffed21
Thanks again to all contributors for your solid groundwork - it saved me a lot of time!I tried it during Autopilot, it didn't remove anything. It prompted for incorrect usage of MSI pop up and carried on. All HP stuff are still present.
Same thing here. Did you find a solution?
@mark05e @mark05e getting this MSI pop up during uninstallation - there is no logging, so I can't see what's happening.
Same thing as well, I never managed to remove HP Wolf with this script because of the always changing GUIDs
I ended using this script instead - so far uninstalled all HP bloats except 'HP Performance Advisor'. I will add it to the script.
https://github.com/andrew-s-taylor/public/blob/main/De-Bloat/RemoveBloat.ps1
Since you are quoting my forked and significantly modified script here, I don't quite understand why you are addressing mark05e?
Regarding the error in the MSI arguments...
I have now adjusted the corresponding function (HP Wolf Fallback) in my fork, especially since I didn't like having to work with hardcoded GUIDs and blindly trying "msiexec /x {GUID} /qn /norestart" anyway.
The output of the MSI itself is now also logged to "C:\Windows\Temp\HPWolfUninstall_.log". Maybe you would like to try again.
I can't really test it at the moment - due to the lack of a suitable system.
Or jeah... use the version from @andrew-s-taylor linked above.
Hi, I applied clean coding to the script. Hope this helps and makes the script more professional.
`# 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 Support Assistant"
"HP Wolf Security"
"HP Wolf Security Application Support for Sure Sense"
"HP Wolf Security Application Support for Windows"
)
$optimizerUninstallAnswer = @"
[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
"@
Run inventories
$HPidentifier = "AD2F1837"$UninstallPackages -contains $ .Name) -or ($.Name -match "^$HPidentifier")} -Verbose$UninstallPackages -contains $ .DisplayName) -or ($.DisplayName -match "^$HPidentifier")} -Verbose
$HPSAuninstall = "$ {Env:ProgramFiles(x86)}\HP\HP Support Framework\UninstallHPSA.exe"
$InstalledPackages = Get-AppxPackage -AllUsers | Where-Object {(
$ProvisionedPackages = Get-AppxProvisionedPackage -Online | Where-Object {(
$InstalledPrograms = Get-Package | Where-Object {$UninstallPrograms -contains $.Name} -Verbose
$HPCommRecoveryPresent = Test-Path -Path "C:\Program Files\HPCommRecovery"
$apps = Get-WmiObject -Class Win32_Product | Where-Object {$.Name -match "HP"}
Remove HP APPX provisioned packages - AppxProvisionedPackage
function Step1 {
ForEach ($ProvPackage in $ProvisionedPackages) {
Write-Host -Object "Attempting to remove provisioned package: [$($ProvPackage.DisplayName)]..."
}
Remove HP APPX packages - AppxPackage
function Step2 {
ForEach ($AppxPackage in $InstalledPackages) {
Write-Host -Object "Attempting to remove Appx package: [$($AppxPackage.Name)]..."
}
Remove HP installed programs
function Step3 {
$InstalledPrograms | ForEach-Object {
Try {
$Null = $_ | Uninstall-Package -AllVersions -Force -ErrorAction Stop -Verbose
Write-Host -Object "Successfully uninstalled: [$($.Name)]"
}
Catch {Write-Warning -Message "Failed to uninstall: [$($.Name)]"}
}
}
Remove HP Win32 Apps
function Step4 {
foreach ($app in $apps) {
$id = $app.IdentifyingNumber
msiexec /uninstall "$id" /quiet /log $msilog /norestart
}
}
Remove HP Connection Optimizer
function Step5 {
if ($HPCommRecoveryPresent) {
$optimizerUninstallAnswer | Out-File $env:TEMP\optimizer.iss
$arguments = "/s /f1
"$env:Temp\optimizer.iss
" /f2"C:\Temp\Uninstall.log
""Start-Process "C:\Program Files (x86)\InstallShield Installation Information{6468C4A5-E47E-405F-B675-A70A70983EA6}\Setup.exe" -ArgumentList $arguments -PassThru -Wait
}
}
Remove HP Documentation
function Step6 {
#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 Active Support
function Step7 {$($ .Exception.Message)"
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
}
catch {
Write-Host "Error retreiving registry key for HP Support Assistant: $($.Exception.Message)"
}
}
else {
Write-Host "HP Support Assistant regkey not found"
}
}
Check is apps are still present
function Step8 {
$apps = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "HP"}
if ($apps) {
#Try to remove apps that are still present
foreach ($app in $apps) {
$id = $app.IdentifyingNumber
msiexec /uninstall "$id" /quiet /log $msilog /norestart
}
}
}
Start with the first function
Step1`