Log a PowerShell Session to a File (Start-Transcript)

Capture every command and its output in a running PowerShell session into a timestamped log file.

WindowslogtranscriptpowershellLow risk
Run Start-Transcript -Path session.log to begin recording and Stop-Transcript when you are done.

01Command

Command
$ Start-Transcript -Path "$env:USERPROFILE\Desktop\session.log"

02What it does

Start-Transcript records everything that appears in the console — your commands, outputs, errors and even the header with machine details — until you call Stop-Transcript or close the window. It is the reliable way to keep evidence of a long troubleshooting session or to produce logs for a support ticket. Use -Append to add to an existing file instead of overwriting it.

03Risk

RiskLow risk
!Warning: Closing the PowerShell window without Stop-Transcript can leave the log file without a proper footer (and in older hosts, empty).

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Start-Transcript
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents Start-Transcript creating a transcript file of all session input and output, stopped by Stop-Transcript, with -Append to continue an existing file.

Last verified: 2026-09-18 · Category: Developer

06Related solutions