KIll a Process exceeding x GB Memory in Windows Server 2016 with bash (x > Int Range)

706 Views Asked by At

I'm trying to auto kill a process via batch script in Windows Server 2016. The process should be killed if the Memory usage of any process is above 12GB.

There is already a Version to kill processes below the maximum INT value: kill process if it exceeds 6GB

This does NOT work for bigger values than INT can handle. You can't kill a task bigger than 2,147,483,647 x 2.

So

taskkill /F /FI "MemUsage gt 12000000000"

results in

ERROR: The search filter cannot be recognized.

Any idea how to circumvent the (32-Bit) Limit in the MemUsage filter given by the Integer Range?

Taskkill documentation: https://ss64.com/nt/taskkill.html

1

There are 1 best solutions below

1
Roger012 On

Solved. See Comment from Daemon-5:

WMIC.EXE Process WHERE (WorkingSetSize ^> 12000000000) CALL Terminate