PowerShell Genie

Start-Transcript

Use Start-Transcript to begin recording the session, both commands and their output, to a text file.

Command 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — PowerShell module reference

Syntax

1PS> Start-Transcript [[-Path] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Start-Transcript [[-Path] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [<CommonParameters>]
  1. Stage 1Start-Transcript-Path -Append -Force -NoClobber -IncludeInvocationHeader

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Start-Transcript -Format 'yyyyMMdd-HHmmss'

    1PS> $log = 'C:\Temp\run-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.log'
    2PS> Write-Output $log
    Show reference output

    Sample output · fictional data, shaped like the real thing

    C:\Temp\run-20260910-234712.log

    Start-Transcript -Format 'yyyyMMdd-HHmmss' (2)

    1PS> $log = 'C:\Temp\run-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.log'
    2PS> Start-Transcript -Path $log -IncludeInvocationHeader
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Transcript started, output file is C:\Temp\PowerShell_transcript.20260910.txt

    Start-Transcript -Format 'yyyyMMdd-HHmmss' (3)

    1PS> $log = 'C:\Temp\run-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.log'
    2PS> try { Start-Transcript -Path $log } finally { Stop-Transcript }
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Transcript started, output file is C:\Temp\run-20260910-234712.log
    Transcript stopped, output file is C:\Temp\run-20260910-234712.log

    Parameters

    Parameter definitions:

    • -Path
    • -Append
    • -Force
    • -NoClobber
    • -IncludeInvocationHeader

    PowerShell module reference on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Start-Transcript when you need to begin recording the session, both commands and their output, to a text file. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: An unwritable destination prevents transcript creation. Check the directory and account permissions and choose a protected logging location that does not expose sensitive command text. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Stop-Transcript. Start-Transcript begins a session transcript; Stop-Transcript ends it. A transcript is a useful diagnostic record but not a structured substitute for the objects returned by a function. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Start-Transcript reference on Microsoft Learn

    Recap

    Start-Transcript Use Start-Transcript to begin recording the session, both commands and their output, to a text file.

    Next: Stop-Transcript
    Genie guideStart-Transcript

    Use Start-Transcript to begin recording the session, both commands and their output, to a text file. The console below is pre-loaded — run it, then change a value and run it again.