Windows Defender & Event Viewer

I’m trying to write a PowerShell script to automate some scanning activities using Windows Defender. I’ve noticed a limitation with the published code which I’m interested to know whether or not there is a workaround.

Is there any reason why when you run this:

Start-MpScan -ScanType CustomScan -ScanPath "C:\Files"

That the scan does not get added into the event viewer?

I need this because I need a way to keep a log of what files were scanned? If I could output the results of the scan directly from PowerShell that would be even better but I don’t believe this function returns anything. Any pointers appreciated.

Your code look a little wonky