0
Is it possible on Windows to use task scheduler or other methods to run a script if the memory usage on the device goes above a certain level?
0
Is it possible on Windows to use task scheduler or other methods to run a script if the memory usage on the device goes above a certain level?
1
PowerShell might work well for this. You could schedule something like this to run every so often to check memory and then run your script. If you already have a script you just have to add '& PathTo\yourscript.bat' into the if statement.
$memory = gwmi -Class win32_operatingsystem -computername localhost |
Select-Object @{Name = "MemoryUsage"; Expression = {“{0:N0}” -f
((($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)*100)/
$_.TotalVisibleMemorySize)}}
$memoryUsage = [int]$memory.MemoryUsage
#if usage over 90% do something
if ($memoryUsage -gt 90){
echo "script goes here"
}