PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 824
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Get all malwares detections

Post by matteu » 1 person likes this post

Hello,

With some people help me, I have this "script" to get all differents malwares detections based on date + VM name + Path.
This is usefull to avoid read several files.

Code: Select all

$Path = "C:\ProgramData\Veeam\Backup\Malware_Detection_Logs\"
$Files = (Get-ChildItem -Path $Path).FullName
 
Select-String -Path $Files -Pattern '^\[(?<Date>[^\]]+).+\s(?<VM>[^:]+):.+?:(?<File>.+)' -AllMatches |
    ForEach-Object {
        $match = $_.Matches[0]
        [PSCustomObject]@{
            Date = $match.Groups['Date'].Value
            VM   = $match.Groups['VM'].Value
            File = $match.Groups['File'].Value
        }
     } |
     Sort-Object VM, File -Unique
Image
david.domask
Veeam Software
Posts: 2312
Liked: 552 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get all malwares detections

Post by david.domask »

Cool Script, thank you for sharing it @matteu!
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests