Powershell Basic Training Workflow

PowerShell for Security & Development: Training Workflow Cheatsheet

This cheatsheet is organised into a logical workflow, from initial reconnaissance to advanced persistence and evasion.

Use this resource responsibly and only on systems you own or have explicit permission to test.

Legend & Best Practices

  • #: Comment explaining the command.

  • $*: Represents a placeholder you must replace.

  • OPSEC (Operational Security): Always consider the detectability of these commands. Many are flagged by Endpoint Detection and Response (EDR) systems.

  • Execution Policy: The first step is often to bypass the restrictive execution policy.

    # Common Bypass Methods
    powershell.exe -ExecutionPolicy Bypass -File .\script.ps1
    powershell.exe -EP Bypass -Command "Get-Process"
    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force

Phase 1: Reconnaissance & Enumeration

Goal: Gather information about the target system and network.

System Information

Network Configuration

User & Domain Information

Process & Service Enumeration


Phase 2: Credential Access & Harvesting

Goal: Locate and extract credentials from various sources.

Stored Credentials

In-Memory Credentials (Mimikatz)

File System & Registry Searches


Phase 3: Execution & Lateral Movement

Goal: Execute code on the local and remote systems.

Local Execution

Remote Execution

Persistence Mechanisms


Phase 4: Privilege Escalation

Goal: Gain higher privileges on the current system.

Token Manipulation

Service Abuse

UAC Bypass


Phase 5: Defence Evasion & Obfuscation

Goal: Avoid detection by security tools and analysts.

AMSI & Defender Bypass

Command & String Obfuscation

File & Memory Evasion


Phase 6: Command & Control (C2)

Goal: Establish a remote channel for command execution and data exfiltration.

Reverse Shells

Encrypted & Resilient C2


Phase 7: Discovery & Pillaging

Goal: Find, collect, and exfiltrate sensitive data.

File System Monitoring

Network Sniffing

Data Exfiltration


Appendix: Advanced Techniques

PowerShell & .NET Integration

Windows API Calls via P/Invoke

Low-Level System Interaction (NtObjectManager Module)


Quick-Reference Command Index

Category

Primary Cmdlet / Technique

Enumeration

Get-WmiObject, Get-NetIPConfiguration, Get-ADUser

Credential Access

Invoke-Mimikatz, netsh wlan show profile, cmdkey /list

Execution

Invoke-Expression (IEX), Invoke-Command, New-ScheduledTask

Privilege Escalation

Get-NtTokenPrivilege, Enable-NtTokenPrivilege, sc.exe config

Defense Evasion

AMSI Bypass, Set-ExecutionPolicy Bypass, Base64 Encoding

C2

TCPClient Reverse Shell, Invoke-WebRequest, Invoke-RestMethod

Persistence

Register-ScheduledTask, New-ItemProperty (Registry)

Final Warning: This is a powerful resource. Use it to strengthen your defences by understanding the offensive techniques.

Last updated