'KIll a Process exceeding x GB Memory in Windows Server 2016 with bash (x > Int Range)
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
Solution 1:[1]
Solved. See Comment from Daemon-5:
WMIC.EXE Process WHERE (WorkingSetSize ^> 12000000000) CALL Terminate
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Roger012 |
