How Grail: Stop - Or At Least Lower Priority - of Auto-Running Services

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AlFlo
Posts: 355
Joined: 29 Nov 2021, 21:46

How Grail: Stop - Or At Least Lower Priority - of Auto-Running Services

Post by AlFlo » 12 Apr 2024, 15:46

For well over a year, I've been trying to get my AHK script which calculates a bunch of math, then automatically pastes the information (i.e. sends the resulting strings) to my Word accounting spreadsheets.

The script works great EXCEPT when a self-spawning service (such as HP TouchPoint Analytics) or another bloatware self-spawning service which - no matter how many times you delete it, keeps spawning again like a bad zombie movie and hogging both CPU and memory.

I'm using an HP Pavillion laptop and Windows 11.

I've of course tried to disable the service in task manager and task scheduler and all of the other normal ways.

I've tried using SKAN/mikeyww's excellent script to wait until CPU is fairly available to launch the script:

Code: Select all

; This script waits for CPU load to drop before proceeding
#Requires AutoHotkey v1.1.33
SoundBeep 1500
SetTimer go, -1
SoundBeep 1000
waitCPU(15)
ToolTip
MsgBox 64, Status, ne!, 1

go() {
 Loop 100 {
  Sleep 1
  ToolTip % "===> " A_Index " <==="
 }
}

CPULoad() { ; CPULoad() by SKAN
 ; https://github.com/jNizM/SysMeter/blob/master/src/SysMeter.ahk#L335
 Static PIT, PKT, PUT
 If (PIT = "")
  Return 0, DllCall("GetSystemTimes", "Int64P", PIT, "Int64P", PKT, "Int64P", PUT)
 DllCall("GetSystemTimes", "Int64P", CIT, "Int64P", CKT, "Int64P", CUT)
 IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT
 SystemTime := KernelTime + UserTime
 Return (SystemTime - IdleTime) * 100 // SystemTime, PIT := CIT, PKT := CKT, PUT := CUT
}

cpu() {
 n := 0, load := []
 While (n < 4) {
  If (0 < c := CPULoad())
   load[n := Mod(n, 4) + 1] := c
  Sleep, 100
 }
 Return Round((load.1 + load.2 + load.3 + load.4) / 4)
}

waitCPU(pct) {
 While cpu() > pct
  Sleep, 500
}
I've of course made my AHK script high priority:

Code: Select all

Process, Priority, , High
I've tried having taskkill try to kill it:

Code: Select all

Run, taskkill /f /im TouchpointAnalyticsClientService.exe,,hide
And out of desperation I even tried a kill loop, but that crashed my computer:

Code: Select all

DetectHiddenWindows, On
Loop 3000
{
 Run, taskkill /f /im TouchpointAnalyticsClientService.exe,,hide
}
But nothing works...

After spending hours on HP and other discussion boards, I'm convinced that HP Touchpoint Analytics is spyware or at the very least impossible-to-remove bloatware (which it euphemistically calls "telemetry"), and that HP put a lot of effort into making sure it can't be disabled or killed.

Bloatware/spyware is one thing ... but bloatware which is so resource-intensive that I can't run my AHK script makes me crazy.

So the question is: can AHK be used to either kill it, or at least make it lowest-possible priority, so it doesn't keep preventing my script from running?

As usual, I can paste my AHK script in here so people can see it, although it is very long. Just let me know and I will paste it.

Thanks in advance!

gregster
Posts: 9075
Joined: 30 Sep 2013, 06:48

Re: How Grail: Stop - Or At Least Lower Priority - of Auto-Running Services

Post by gregster » 12 Apr 2024, 16:18

Does your script have sufficient rights to kill the process?
https://www.autohotkey.com/docs/v1/FAQ.htm#uac

AlFlo
Posts: 355
Joined: 29 Nov 2021, 21:46

Re: How Grail: Stop - Or At Least Lower Priority - of Auto-Running Services

Post by AlFlo » 12 Apr 2024, 17:03

Gregster, I am launching my script with administrator privileges. I haven't tried any of the other options listed in
"How do I work around problems caused by User Account Control (UAC)?"

AlFlo
Posts: 355
Joined: 29 Nov 2021, 21:46

Re: How Grail: Stop - Or At Least Lower Priority - of Auto-Running Services

Post by AlFlo » 12 Apr 2024, 18:00

I also enabled the Add 'Run with UI Access' on the script, but it still didn't work. HP bloatware resource-hogging services are still automatically respawning themselves.

AlFlo
Posts: 355
Joined: 29 Nov 2021, 21:46

Re: How Grail: Stop - Or At Least Lower Priority - of Auto-Running Services

Post by AlFlo » 29 Apr 2024, 23:33

I'm still banging my head against the wall ...

For example, here's my current script trying to at least lower the priority of the auto-spawning (rootkit) scripts from HP and Microsoft:

Code: Select all

#Persistent
Process, Priority, , High
DetectHiddenWindows, On

If A_IsAdmin && !RegExMatch(DllCall("GetCommandLine", "str"), " /restart(?!\S)") {
 Try Run "%A_AhkPath%" /restart "%A_ScriptFullPath%"
 ExitApp
}

SetTimer, SlowStupidProcess, 5000
Return

SlowStupidProcess:

Process, Priority, OneDrive.exe, Low
Process, Priority, Teams.exe, Low
Process, Priority, Spotify.exe, Low
Process, Priority, msedgewebview2.exe, Low
Process, Priority, SearchIndexer.exe, Low
Process, Priority, SearchHost.exe, Low
Process, Priority, SearchProtocolHost.exe, Low
Process, Priority, SoftwareUpdateNotificationService.exe, Low
Process, Priority, FileCoAuth.exe, Low
Process, Priority, AutoUpdater.exe, Low
Process, Priority, HPAudioSwitch.exe, Low
Process, Priority, hp-one-agent-service.exe, Low
Process, Priority, TouchpointAnalyticsClientService.exe, Low
Process, Priority, ctfmon.exe, Low
Process, Priority, FoxitPDFEditorUpdateService.exe, Low
Process, Priority, Widgets.exe, Low
Process, Priority, WidgetService.exe, Low
Process, Priority, hp-plugin-executor.exe, Low
Process, Priority, ai.exe, Low

Esc::ExitApp
But it is not doing ANYTHING to actually lower the priority of those listed scripts.

Any ideas?

Post Reply

Return to “Ask for Help (v1)”