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!

Hi

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

How to Check Your Computer's Memory Usage in Windows.

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

something like Browse code samples | Microsoft Docs