Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Parse Log File

$
0
0

We are using the Microsoft Malicious Software Removal Tool and it creates an MRT.log file on a network share on the server.

I need a script to parse all the logs (500+) and see if it can match any "Return Code: 6 - 9" if yes than copy the log to a different share and write the name the of the log to a csv file.

I know I have to use regex but I have no clue how.

This is what I have:

$logfiles = "C:\Windows\debug\MRTLOGS"
foreach ($logs in $logfiles){
if (select-string -Pattern "Return code: 6"){

#Write-Host ($_.name)
}
}

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>