V
V
vista1x2015-06-14 12:12:27
PowerShell
vista1x, 2015-06-14 12:12:27

Monitor process RAM usage?

Task: start the process and track the amount of RAM allocated for this process.
Everything is done in PowerShell.
The script is like this:

$process = new-object System.Diagnostics.Process;
$process.StartInfo.filename = "[путь к exe]";
$process.Start();
write-host $process.WorkingSet;

The problem is this: if the process runs for 2-4 seconds (or does not end at all), then the correct amount of memory is returned. If the process starts and immediately ends, then WorkingSet returns 0. How to deal with this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question