dfirhub

MemoryFiles

Author: Ahmed Elshaer, Teo Kia Meng

description

Memory Files

paths

5 paths
Memoryhiberfil.sys
C:\hiberfil.sys
Memorypagefile.sys
C:\pagefile.sys
Memoryswapfile.sys
C:\swapfile.sys
MemorySmall Memory Dump directory
C:\Windows\Minidump\*.dmp

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/small-memory-dump

MemorySmall Memory Dump directory
C:\Windows.old\Windows\Minidump\*.dmp

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/small-memory-dump

paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: MemoryFiles
# 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. hiberfil.sys
Collect-Artifact -SourcePath "C:\\hiberfil.sys" -FolderName "hiberfil_sys"

# 2. pagefile.sys
Collect-Artifact -SourcePath "C:\\pagefile.sys" -FolderName "pagefile_sys"

# 3. swapfile.sys
Collect-Artifact -SourcePath "C:\\swapfile.sys" -FolderName "swapfile_sys"

# 4. Small Memory Dump directory
Collect-Artifact -SourcePath "C:\Windows\Minidump\\*.dmp" -FolderName "Small_Memory_Dump_directory"

# 5. Small Memory Dump directory
Collect-Artifact -SourcePath "C:\Windows.old\Windows\Minidump\\*.dmp" -FolderName "Small_Memory_Dump_directory"

Write-Host "Collection complete!" -ForegroundColor Green

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

references