Is there a way using WMIC, bat files, or powershell, to kill a task with a particular task name if the amount of virtual memory the process is using is above a certain limit?
Specifically I want to kill any instance of the iexplore.exe process if its workingset (RAM usage) or Virtual memory allocation is above 1GB.
I can kill a task using taskkill using this cmd:
taskkill.exe /F /IM iexplore.exe and I can filter a list of processes and their RAM usage using this cmd
wmic process where "name='iexplore.exe' and workingsetsize>=1000000000" get name, workingsetsize, processid.