{"id":7476,"date":"2023-11-22T00:24:43","date_gmt":"2023-11-22T00:24:43","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=7476"},"modified":"2023-11-22T00:24:46","modified_gmt":"2023-11-22T00:24:46","slug":"intune-proactive-remediation-remove-hp-bloatware-such-as-hp-sure-click-and-hp-wolf","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/intune-proactive-remediation-remove-hp-bloatware-such-as-hp-sure-click-and-hp-wolf","title":{"rendered":"Intune Proactive Remediation Remove HP Bloatware such as HP Sure Click and HP Wolf"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">#Detect HP bloatware \/ crapware\r\n#-- source : https:\/\/gist.github.com\/mark05e\/a79221b4245962a477a49eb281d97388\r\n\r\n#List of built-in apps to remove\r\n$UninstallPackages = @(\r\n   # \"AD2F1837.HPJumpStarts\"\r\n   # \"AD2F1837.HPPCHardwareDiagnosticsWindows\"\r\n   # \"AD2F1837.HPPowerManager\"\r\n   # \"AD2F1837.HPPrivacySettings\"\r\n   # \"AD2F1837.HPSupportAssistant\"\r\n   # \"AD2F1837.HPSureShieldAI\"\r\n   # \"AD2F1837.HPSystemInformation\"\r\n   # \"AD2F1837.HPQuickDrop\"\r\n   # \"AD2F1837.HPWorkWell\"\r\n   # \"AD2F1837.myHP\"\r\n   # \"AD2F1837.HPDesktopSupportUtilities\"\r\n   # \"AD2F1837.HPQuickTouch\"\r\n   # \"AD2F1837.HPEasyClean\"\r\n   # \"AD2F1837.HPSystemInformation\"\r\n)\r\n\r\n#List of programs to uninstall\r\n$UninstallPrograms = @(\r\n    #\"HP Client Security Manager\"\r\n    #\"HP Connection Optimizer\"\r\n    #\"HP Documentation\"\r\n    #\"HP MAC Address Manager\"\r\n    #\"HP Notifications\"\r\n    \"HP Security Update Service\"\r\n    #\"HP System Default Settings\"\r\n    \"HP Sure Click\"\r\n    \"HP Sure Click Security Browser\"\r\n    \"HP Sure Run\"\r\n    \"HP Sure Recover\"\r\n    \"HP Sure Sense\"\r\n    \"HP Sure Sense Installer\"\r\n)\r\n\r\n$HPidentifier = \"AD2F1837\"\r\n\r\n$InstalledPackages = Get-AppxPackage -AllUsers `\r\n            | Where-Object {($UninstallPackages -contains $_.Name) -or ($_.Name -match \"^$HPidentifier\")}\r\n\r\n$ProvisionedPackages = Get-AppxProvisionedPackage -Online `\r\n            | Where-Object {($UninstallPackages -contains $_.DisplayName) -or ($_.DisplayName -match \"^$HPidentifier\")}\r\n\r\n$InstalledPrograms = Get-Package | Where-Object {$UninstallPrograms -contains $_.Name}\r\n\r\n$InstalledWolfSecurityPrograms = Get-WmiObject Win32_Product | Where-Object { $_.name -like \"HP Wolf Security*\" }\r\n\r\nif (($InstalledPackages) -or ($ProvisionedPackages) -or ($InstalledPrograms) -or ($InstalledWolfSecurityPrograms)) {\r\n    #Apps detected, need to run removal script\r\n    Write-Host \"Apps detected, starting removal script\"\r\n    exit 1\r\n}\r\n\r\nWrite-Host \"No apps detected\"\r\nexit 0<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">#Remove HP bloatware \/ crapware\r\n#-- source : https:\/\/gist.github.com\/mark05e\/a79221b4245962a477a49eb281d97388\r\n\r\n#Remove HP Documentation\r\nif (Test-Path \"${Env:ProgramFiles}\\HP\\Documentation\\Doc_uninstall.cmd\" -PathType Leaf) {\r\n    try {\r\n        Invoke-Item \"${Env:ProgramFiles}\\HP\\Documentation\\Doc_uninstall.cmd\"\r\n        Write-Host \"Successfully removed provisioned package: HP Documentation\"\r\n    }\r\n    catch {\r\n        Write-Host \"Error Remvoving HP Documentation $($_.Exception.Message)\"\r\n    }\r\n}\r\nelse {\r\n    Write-Host \"HP Documentation is not installed\"\r\n}\r\n\r\n#Remove HP Support Assistant silently\r\n$HPSAuninstall = \"${Env:ProgramFiles(x86)}\\HP\\HP Support Framework\\UninstallHPSA.exe\"\r\n\r\nif (Test-Path -Path \"HKLM:\\Software\\WOW6432Node\\Hewlett-Packard\\HPActiveSupport\") {\r\n    try {\r\n        Remove-Item -Path \"HKLM:\\Software\\WOW6432Node\\Hewlett-Packard\\HPActiveSupport\"\r\n        Write-Host \"HP Support Assistant regkey deleted $($_.Exception.Message)\"\r\n    }\r\n    catch {\r\n        Write-Host \"Error retreiving registry key for HP Support Assistant: $($_.Exception.Message)\"\r\n    }\r\n}\r\nelse {\r\n    Write-Host \"HP Support Assistant regkey not found\"\r\n}\r\n\r\nif (Test-Path $HPSAuninstall -PathType Leaf) {\r\n    try {\r\n        &amp; $HPSAuninstall \/s \/v\/qn UninstallKeepPreferences=FALSE\r\n        Write-Host \"Successfully removed provisioned package: HP Support Assistant silently\"\r\n    }\r\n    catch {\r\n        Write-Host \"Error uninstalling HP Support Assistant: $($_.Exception.Message)\"\r\n    }\r\n}\r\nelse {\r\n    Write-Host \"HP Support Assistant Uninstaller not found\"\r\n}\r\n\r\n#Remove HP Connection Optimizer\r\n$HPCOuninstall = \"${Env:ProgramFiles(x86)}\\InstallShield Installation Information\\{6468C4A5-E47E-405F-B675-A70A70983EA6}\\setup.exe\"\r\nif (Test-Path $HPCOuninstall -PathType Leaf) {\r\n    Try {\r\n        # Generating uninstall file\r\n        \"[InstallShield Silent]\r\n        Version=v7.00\r\n        File=Response File\r\n        [File Transfer]\r\n        OverwrittenReadOnly=NoToAll\r\n        [{6468C4A5-E47E-405F-B675-A70A70983EA6}-DlgOrder]\r\n        Dlg0={6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0\r\n        Count=2\r\n        Dlg1={6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinish-0\r\n        [{6468C4A5-E47E-405F-B675-A70A70983EA6}-MessageBox-0]\r\n        Result=6\r\n        [Application]\r\n        Name=HP Connection Optimizer\r\n        Version=2.0.19.0\r\n        Company=HP\r\n        Lang=0413\r\n        [{6468C4A5-E47E-405F-B675-A70A70983EA6}-SdFinish-0]\r\n        Result=1\r\n        bOpt1=0\r\n        bOpt2=0\" | Out-File -FilePath \"${Env:Temp}\\uninstallHPCO.iss\" -Encoding UTF8 -Force:$true -Confirm:$false\r\n\r\n        Write-Host \"Successfully created uninstall file ${Env:Temp}\\uninstallHPCO.iss\"\r\n\r\n        &amp; $HPCOuninstall -runfromtemp -l0x0413 -removeonly -s -f1${Env:Temp}\\uninstallHPCO.iss\r\n        Write-Host \"Successfully removed HP Connection Optimizer\"\r\n    }\r\n    Catch {\r\n        Write-Host \"Error uninstalling HP Connection Optimizer: $($_.Exception.Message)\"\r\n    }\r\n}\r\nElse {\r\n    Write-Host \"HP Connection Optimizer not found\"\r\n}\r\n\r\n#List of built-in apps to remove\r\n$UninstallPackages = @(\r\n   # \"AD2F1837.HPJumpStarts\"\r\n   # \"AD2F1837.HPPCHardwareDiagnosticsWindows\"\r\n   # \"AD2F1837.HPPowerManager\"\r\n   # \"AD2F1837.HPPrivacySettings\"\r\n   # \"AD2F1837.HPSupportAssistant\"\r\n   # \"AD2F1837.HPSureShieldAI\"\r\n   # \"AD2F1837.HPSystemInformation\"\r\n   # \"AD2F1837.HPQuickDrop\"\r\n   # \"AD2F1837.HPWorkWell\"\r\n   # \"AD2F1837.myHP\"\r\n   # \"AD2F1837.HPDesktopSupportUtilities\"\r\n   # \"AD2F1837.HPQuickTouch\"\r\n   # \"AD2F1837.HPEasyClean\"\r\n   # \"AD2F1837.HPSystemInformation\"\r\n)\r\n\r\n#List of programs to uninstall\r\n$UninstallPrograms = @(\r\n    #\"HP Client Security Manager\"\r\n    #\"HP Connection Optimizer\"\r\n    #\"HP Documentation\"\r\n    #\"HP MAC Address Manager\"\r\n    #\"HP Notifications\"\r\n    \"HP Security Update Service\"\r\n    #\"HP System Default Settings\"\r\n    \"HP Sure Click\"\r\n    \"HP Sure Click Security Browser\"\r\n    \"HP Sure Run\"\r\n    \"HP Sure Recover\"\r\n    \"HP Sure Sense\"\r\n    \"HP Sure Sense Installer\"\r\n)\r\n\r\n$HPidentifier = \"AD2F1837\"\r\n\r\n$InstalledPackages = Get-AppxPackage -AllUsers `\r\n| Where-Object { ($UninstallPackages -contains $_.Name) -or ($_.Name -match \"^$HPidentifier\") }\r\n\r\n$ProvisionedPackages = Get-AppxProvisionedPackage -Online `\r\n| Where-Object { ($UninstallPackages -contains $_.DisplayName) -or ($_.DisplayName -match \"^$HPidentifier\") }\r\n\r\n$InstalledPrograms = Get-Package | Where-Object { $UninstallPrograms -contains $_.Name } | Sort-Object Name -Descending\r\n\r\n#Remove appx provisioned packages - AppxProvisionedPackage\r\nForEach ($ProvPackage in $ProvisionedPackages) {\r\n    Write-Host -Object \"Attempting to remove provisioned package: [$($ProvPackage.DisplayName)]...\"\r\n    try {\r\n        $Null = Remove-AppxProvisionedPackage -PackageName $ProvPackage.PackageName -Online -ErrorAction Stop\r\n        Write-Host -Object \"Successfully removed provisioned package: [$($ProvPackage.DisplayName)]\"\r\n    }\r\n    catch { Write-Warning -Message \"Failed to remove provisioned package: [$($ProvPackage.DisplayName)]\" }\r\n}\r\n\r\n#Remove appx packages - AppxPackage\r\nForEach ($AppxPackage in $InstalledPackages) {                                        \r\n    Write-Host -Object \"Attempting to remove Appx package: [$($AppxPackage.Name)]...\"\r\n    try {\r\n        $Null = Remove-AppxPackage -Package $AppxPackage.PackageFullName -AllUsers -ErrorAction Stop\r\n        Write-Host -Object \"Successfully removed Appx package: [$($AppxPackage.Name)]\"\r\n    }\r\n    catch { Write-Warning -Message \"Failed to remove Appx package: [$($AppxPackage.Name)]\" }\r\n}\r\n\r\n#Remove installed programs\r\nForEach ($InstalledProgram in $InstalledPrograms) {\r\n    Write-Host -Object \"Attempting to uninstall: [$($InstalledProgram.Name)]...\"\r\n    try {\r\n        $Null = $InstalledProgram | Uninstall-Package -AllVersions -Force -ErrorAction Stop\r\n        Write-Host -Object \"Successfully uninstalled: [$($InstalledProgram.Name)]\"\r\n    }\r\n    catch {\r\n        Write-Warning -Message \"Failed to uninstall: [$($InstalledProgram.Name)]\"\r\n        Write-Host -Object \"Attempting to uninstall as MSI package: [$($InstalledProgram.Name)]...\"\r\n        try {\r\n            $MSIApp = Get-WmiObject Win32_Product | Where-Object { $_.name -like \"$($InstalledProgram.Name)\" }\r\n            if ($null -ne $MSIApp.IdentifyingNumber) {\r\n                Start-Process -FilePath msiexec.exe -ArgumentList @(\"\/x $($MSIApp.IdentifyingNumber)\", \"\/quiet\", \"\/noreboot\") -Wait\r\n            }\r\n            else { Write-Warning -Message \"Can't find MSI package: [$($InstalledProgram.Name)]\" }\r\n        }\r\n        catch { Write-Warning -Message \"Failed to uninstall MSI package: [$($InstalledProgram.Name)]\" }\r\n    }\r\n}\r\n\r\n#Try to remove all HP Wolf Security apps using msiexec\r\n$InstalledWolfSecurityPrograms = Get-WmiObject Win32_Product | Where-Object { $_.name -like \"HP Wolf Security*\" }\r\nForEach ($InstalledWolfSecurityProgram in $InstalledWolfSecurityPrograms) {\r\n    try {\r\n        if ($null -ne $InstalledWolfSecurityProgram.IdentifyingNumber) {\r\n            Start-Process -FilePath msiexec.exe -ArgumentList @(\"\/x $($InstalledWolfSecurityProgram.IdentifyingNumber)\", \"\/quiet\", \"\/noreboot\") -Wait\r\n            Write-Host \"Attempting to uninstall as MSI package: [$($InstalledWolfSecurityProgram.Name)]...\"\r\n        }\r\n        else { Write-Warning -Message \"Can't find MSI package: [$($InstalledWolfSecurityProgram.Name)]\" }\r\n    }\r\n    catch {\r\n        Write-Warning -Message \"Failed to uninstall MSI package: [$($InstalledWolfSecurityProgram.Name)]\"\r\n    }\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7476","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/7476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=7476"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/7476\/revisions"}],"predecessor-version":[{"id":7477,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/7476\/revisions\/7477"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=7476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=7476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=7476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}