WindowsDefender
Author: Drew Ervin
description
Windows Defender Data
paths
9 paths
AntivirusWindows Defender Logs
C:\ProgramData\Microsoft\Microsoft AntiMalware\Support\EventLogsWindows Defender Event Logs
C:\Windows\System32\winevt\Logs\Microsoft-Windows-Windows Defender*.evtxEventLogsWindows Defender Event Logs
C:\Windows.old\Windows\System32\winevt\Logs\Microsoft-Windows-Windows Defender*.evtxAntivirusWindows Defender Logs
C:\ProgramData\Microsoft\Windows Defender\Support\AntivirusWindows Defender Logs
C:\Windows\Temp\MpCmdRun.logAntivirusWindows Defender Logs
C:\Windows.old\Windows\Temp\MpCmdRun.logAntivirusDetectionHistory
C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\DetectionHistory\*\AntivirusWindows Defender Quarantine
C:\ProgramData\Microsoft\Windows Defender\Quarantine\AntivirusWindows Defender Detections.log
C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\Detections.log› 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 directory creation and copying
function Collect-Artifact {
param (
[string]$SourcePath,
[string]$FolderName
)
$FullDest = Join-Path -Path $DestBase -ChildPath $FolderName
if (-not (Test-Path -Path $FullDest)) {
New-Item -ItemType Directory -Path $FullDest -Force | Out-Null
}
Copy-Item -Path $SourcePath -Destination $FullDest -Recurse -Force
}
# 1. Windows Defender Logs
Collect-Artifact -SourcePath "C:\ProgramData\Microsoft\Microsoft AntiMalware\Support\\*" -FolderName "Windows_Defender_Logs"
# 2. Windows Defender Event Logs
Collect-Artifact -SourcePath "C:\Windows\System32\winevt\Logs\\Microsoft-Windows-Windows Defender*.evtx" -FolderName "Windows_Defender_Event_Logs"
# 3. Windows Defender Event Logs
Collect-Artifact -SourcePath "C:\Windows.old\Windows\System32\winevt\Logs\\Microsoft-Windows-Windows Defender*.evtx" -FolderName "Windows_Defender_Event_Logs"
# 4. Windows Defender Logs
Collect-Artifact -SourcePath "C:\ProgramData\Microsoft\Windows Defender\Support\\*" -FolderName "Windows_Defender_Logs"
# 5. Windows Defender Logs
Collect-Artifact -SourcePath "C:\Windows\Temp\\MpCmdRun.log" -FolderName "Windows_Defender_Logs"
# 6. Windows Defender Logs
Collect-Artifact -SourcePath "C:\Windows.old\Windows\Temp\\MpCmdRun.log" -FolderName "Windows_Defender_Logs"
# 7. DetectionHistory
Collect-Artifact -SourcePath "C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\DetectionHistory\*\\*" -FolderName "DetectionHistory"
# 8. Windows Defender Quarantine
Collect-Artifact -SourcePath "C:\ProgramData\Microsoft\Windows Defender\Quarantine\\*" -FolderName "Windows_Defender_Quarantine"
# 9. Windows Defender Detections.log
Collect-Artifact -SourcePath "C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\\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