WindowsDefender

Author: Drew Ervin

description

Windows Defender Data

paths

9 paths
paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: WindowsDefender
# Run as Administrator

#Requires -RunAsAdministrator

$ErrorActionPreference = "SilentlyContinue"
$DestBase = "D:\Evidence"

# Function to handle artifact collection with robocopy
function Collect-Artifact {
    param (
        [string]$SourceDir,
        [string]$FolderName,
        [string]$FileMask = "*"
    )
    $FullDest = Join-Path -Path $DestBase -ChildPath $FolderName
    robocopy "$SourceDir" "$FullDest" "$FileMask" /E /COPY:DAT /R:0 /W:0 /NP /NFL /NDL /NJH /NJS | Out-Null
}

# 1. Windows Defender Logs
Collect-Artifact -SourceDir "C:\ProgramData\Microsoft\Microsoft AntiMalware\Support\" -FolderName "Windows_Defender_Logs"

# 2. Windows Defender Event Logs
Collect-Artifact -SourceDir "C:\Windows\System32\winevt\Logs\" -FileMask "Microsoft-Windows-Windows Defender*.evtx" -FolderName "Windows_Defender_Event_Logs"

# 3. Windows Defender Event Logs
Collect-Artifact -SourceDir "C:\Windows.old\Windows\System32\winevt\Logs\" -FileMask "Microsoft-Windows-Windows Defender*.evtx" -FolderName "Windows_Defender_Event_Logs"

# 4. Windows Defender Logs
Collect-Artifact -SourceDir "C:\ProgramData\Microsoft\Windows Defender\Support\" -FolderName "Windows_Defender_Logs"

# 5. Windows Defender Logs
Collect-Artifact -SourceDir "C:\Windows\Temp\" -FileMask "MpCmdRun.log" -FolderName "Windows_Defender_Logs"

# 6. Windows Defender Logs
Collect-Artifact -SourceDir "C:\Windows.old\Windows\Temp\" -FileMask "MpCmdRun.log" -FolderName "Windows_Defender_Logs"

# 7. DetectionHistory
Collect-Artifact -SourceDir "C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\DetectionHistory\*\" -FolderName "DetectionHistory"

# 8. Windows Defender Quarantine
Collect-Artifact -SourceDir "C:\ProgramData\Microsoft\Windows Defender\Quarantine\" -FolderName "Windows_Defender_Quarantine"

# 9. Windows Defender Detections.log
Collect-Artifact -SourceDir "C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\" -FileMask "Detections.log" -FolderName "Windows_Defender_Detections_log"

Write-Host "Collection complete!" -ForegroundColor Green

Save as .ps1 and run as Administrator. Use: powershell -ExecutionPolicy Bypass -File script.ps1

references

included in collections