Event/process log file sent to an email address

Hello everyone,

complete powershell noob here. I have a coworker complaining that his laptop clogs up ram usage. I want to write a powershell script that he could run that would log the current processes’ and their memory usage, output it into a file and send it to a desired email address.

Is this just a simple combination of get-process | out-file and send-mailmessage or is there a better way to do it?

Microsoft docs also suggests that the send-mailmessage cmdlet is outdated.


thanks for any input!


This is not a proper way to monitor, as if your mail will be filled with messages that might not lead you to the real cause.

I would recommend to use Performance Monitoring and create some Data Collector set to help you in troubleshooting the issues


if you want to use Powershell, then I would recommend that you trigger the Send-MailMessage when a memory threshold reach

something like https://gallery.technet.microsoft.com/scriptcenter/Monitor-CPU-and-Memory-95c22ee9