Download and run Microsoft Security Scanner (MSERT)

First download:
powershell -Command "& {Start-BitsTransfer -Source "" -Destination "C:\users\public\downloads\msert\msert.exe"}"

C:\Users\Public\Downloads\msert\msert.exe /Q /H

Script to parse log and create Event:
# Requires that New-EventLog -LogName -Source "MSERT" is run on the system first

$msertfile = "C:\Windows\debug\msert.log"
$msertmessage = Get-Content $msertfile
$searchtext = "No infection found"
$source = "MSERT"

if ($msertmessage | Select-String $searchtext -quiet)
{ write-Host $searchtext
Write-EventLog -LogName Application -Source $Source -EventId 0 -Message "$msertmessage" -EntryType Information }
{ Write-EventLog -LogName Application -Source $Source -EventID 1 -Message "$msertmessage" -EntryType Error }

Move logs:
cmd /c move /y "C:\Windows\debug\msert.log" "C:\Users\Public\Downloads\msert\msert_%date:~-7,2%.log"

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.