PowerShell Red & Purple Team Cheatsheet

0. Master Environment Setup (Run once per engagement)

$ErrorActionPreference = 'SilentlyContinue'
Set-ExecutionPolicy Bypass -Scope Process -Force
Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/paradox.omp.json" | Invoke-Expression

# Essential aliases
Set-Alias nmap "$env:ProgramFiles\Nmap\nmap.exe"
Set-Alias vim nvim
Set-Alias k kubectl
Set-Alias ll ls

1. Situational Awareness – First 30 Seconds on Box

whoami /all; hostname
systeminfo | findstr /i "domain OS Build"
ipconfig /all
netstat -ano | Select-String LISTENING
Get-ComputerInfo | Select WindowsProductName, OsBuildNumber, TotalPhysicalMemory, CsDomainRole
Get-Process | Where-Object {$_.Path -match "CrowdStrike|SentinelOne|Cortex|Defender|CarbonBlack|Falcon"}

2. Full 2025 Bypass Chain (AMSI + ETW + ConstrainedLanguage + ScriptBlockLogging)


3. File & Credential Hunting (Fast, Parallel)


4. Native Port Scanner (No External Tools)


5. Credential Access (Ethical/Lab Use Only)


6. Persistence Techniques (2025 Top Tier)


7. Fileless .NET PowerShell Runner (No pwsh.exe on Disk)


8. Native DNS Exfiltration


9. One-Liners Seen in the Wild (2025)


10. Extra 2025 Evasion Techniques


11. Purple Team Hunting Queries

Last updated