PowerShellTranscripts

Author: Andrew Rathbun and Chad Tilbury

description

PowerShell Transcripts

paths

6 paths
paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: PowerShellTranscripts
# 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. PowerShell Transcripts - Default Location
$UserPath = Join-Path $env:USERPROFILE "Documents\"
Collect-Artifact -SourceDir "$UserPath" -FileMask "PowerShell_transcript.*.txt" -FolderName "PowerShell_Transcripts___Default_Location"

# 2. PowerShell Transcripts - Observed Location
$UserPath = Join-Path $env:USERPROFILE "Documents\20*\"
Collect-Artifact -SourceDir "$UserPath" -FileMask "PowerShell_transcript.*.txt" -FolderName "PowerShell_Transcripts___Observed_Location"

# 3. PowerShell Transcripts - Observed Location
Collect-Artifact -SourceDir "C:\Windows\SysWOW64\*\" -FileMask "PowerShell_transcript.*.txt" -FolderName "PowerShell_Transcripts___Observed_Location"

# 4. PowerShell Transcripts - Observed Location
Collect-Artifact -SourceDir "C:\Program Files\Amazon\Ec2ConfigService\Scripts\*\" -FileMask "PowerShell_transcript.*.txt" -FolderName "PowerShell_Transcripts___Observed_Location"

# 5. PowerShell Transcripts - Observed Location
Collect-Artifact -SourceDir "C:\Windows\System32\*\" -FileMask "PowerShell_transcript.*.txt" -FolderName "PowerShell_Transcripts___Observed_Location"

# 6. PowerShell Transcripts - Observed Location
Collect-Artifact -SourceDir "C:\PSTranscript\20*\" -FileMask "PowerShell_transcript.*.txt" -FolderName "PowerShell_Transcripts___Observed_Location"

Write-Host "Collection complete!" -ForegroundColor Green

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

› cyberchef recipes

Open in CyberChef to decode values extracted from this artifact.

references

included in collections