Automated removal of HP bloatware with Intune
We show how new and old computers can be cleaned of HP bloatware using Intune.
We show how new and old computers can be cleaned of HP bloatware using Intune.
Hello to the very first article about Intune and removing HP bloatware. Here is a brief overview of who we are and how we came up with this topic: We are an IT service provider and our many customers from industry, trade and many others include a public school in Saxony-Anhalt. As part of the "Digitalpakt Schule" funding programme, there was money for the purchase of new IT equipment, including HP notebooks for all teachers provided by the state.
Unfortunately, the teachers had to set up the devices themselves, meaning that important settings were not made. As public schools are known to have a certain budget and Office 365 A1 was already in use, we decided to integrate the devices into the central Intune management via Windows Autopilot.
The following does not go into the setup of Intune and Autopilot, but only describes how the HP bloatware apps can be removed automatically.
What are the requirements?
After some research on the Internet, we found a script from Jeroen Burgerhout for removing HP bloatware. Unfortunately, this is no longer completely up-to-date and not all programmes have been removed.
We have added 4 programmes to his script. It can be found in our GitHub repo. At the bottom of the page you will find a description of how the script works.
In order for the script to remove the HP bloatware on all computers and notebooks, it must be published in Intune and assigned to the devices.
Now you just need to assign the programme to the devices, this can be done manually for a handful of devices, or you can create a dynamic group with the HP devices assignment and then select this group under Required.
The script first creates a TAG file. Intune can use this to determine whether the script has been successfully installed.
# Create a tag file just so Intune knows this was installed
if (-not (Test-Path "$($env:ProgramData)\HP\RemoveHPBloatware"))
{
Mkdir "$($env:ProgramData)\HP\RemoveHPBloatware"
}
Set-Content -Path "$($env:ProgramData)\HP\RemoveHPBloatware\RemoveHPBloatware.ps1.tag" -Value "Installed"
In the second part of the script, the Appx packages from HP are defined. Of course, other programmes can also be added and programmes can be excluded.
# Start logging
Start transcript "$($env:ProgramData)\HP\RemoveHPBloatware\RemoveHPBloatware.log"
# List of built-in apps to remove
$UninstallPackages = @(
"AD2F1837.HPEasyClean"
"AD2F1837.HPPCHardwareDiagnosticsWindows"
"AD2F1837.HPPowerManager"
"AD2F1837.HPPrivacySettings"
"AD2F1837.HPProgrammableKey"
"AD2F1837.HPQuickDrop"
"AD2F1837.HPSupportAssistant"
"AD2F1837.HPSystemInformation"
"AD2F1837.HPWorkWell"
"AD2F1837.myHP"
"Tile.TileWindowsApplication"
)
Part three of the script defines the HP programmes that are to be removed. As in part two, programmes can also be added.
# List of programs to uninstall
$UninstallPrograms = @(
"HP Client Security Manager"
"HP Notifications"
"HP Security Update Service"
"HP System Default Settings"
"HP Wolf Security"
"HP Wolf Security Application Support for Sure Sense"
"HP Wolf Security Application Support for Windows"
"HP Connection Optimiser"
"HP Documentation"
"HP Security Update Service"
"HP Sure Click"
"HP Sure Sense Installer"
"HP System Default Settings"
)
In the last part, the programmes and appx packages are now removed.
$HPidentifier = "AD2F1837"
$InstalledPackages = Get-AppxPackage -AllUsers | Where {($UninstallPackages -contains $_.Name)} #-or ($_.Name -match "^$HPidentifier")}
$ProvisionedPackages = Get-AppxProvisionedPackage -Online | Where {($UninstallPackages -contains $_.DisplayName)} #-or ($_.DisplayName -match "^$HPidentifier")}
$InstalledPrograms = Get-Package | Where {$UninstallPrograms -contains $_.Name}
# Remove provisioned packages first
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
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 {
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)]"}
}
Stop-Transcript