1

I need to make kind of script or program which restarts the required windows application when it uses more RAM than 1GB for example. I want to use powershell, but got stuck on getting RAM usage of given app into a variable. I tried $OutputVariable = (Get-Process %processname% | Select-Object WS) | Out-String but that doesn't work, cause I need the value only.

1 Answers1

1
(Get-Process explorer).WS

will give you the value only. But I guess you'd better fix that memory leak instead.

see

What are ways to solve Memory Leaks in C#

What strategies and tools are useful for finding memory leaks in .NET?

How to use IDisposable to fix memory leaks

among others

Community
  • 1
  • 1
sodawillow
  • 12,497
  • 4
  • 34
  • 44