CmdID

CmdID / PowerShell / Cmdlets / Start

Start-Transcript

Creates a record of all or part of a PowerShell session to a text file. PowerShell reference

From the PowerShell reference 9 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Creates a record of all or part of a PowerShell session to a text file. The Start-Transcript cmdlet creates a record of all or part of a PowerShell session to a text file. The transcript includes all command that the user types and all output that appears on the console. By default, Start-Transcript stores the transcript in the following location using the default name: - Default location: $HOME\Documents The default filename is PowerShell_transcript.<computername>.<random>.<timestamp>.txt. Starting in Windows PowerShell 5.0, Start-Transcript includes the hostname in the generated file name of all transcripts. The filename also includes random characters in names to prevent potential overwrites or duplication when you start two or more transcripts simultaneously. Including the computer name is useful if you store your transcripts in a centralized location. The random character string prevents guessing of the filename to gain unauthorized access to the file. When using the Append parameter, if the target file doesn't have a Byte Order Mark (BOM) Start-Transcript defaults to ASCII encoding in the target file. This behavior can result in improper encoding of multibyte characters in the transcript.

Start-Transcript [[-Path] <String>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-WhatIf] [-Confirm] [<CommonParameters>]
Start-Transcript [[-LiteralPath] <String>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-WhatIf] [-Confirm] [<CommonParameters>]
Start-Transcript [[-OutputDirectory] <String>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-WhatIf] [-Confirm] [<CommonParameters>]

Start a transcript file with default settings

Start-TranscriptIdentify

Start a transcript file at a specific location

Start-Transcript -Path "C:\transcripts\transcript0.txt" -NoClobberIdentify

Start a transcript file with a unique name and store it on a file share

$sharePath = '\\Server01\Transcripts' $username = $Env:USERNAME $hostname = hostname $version = $PSVersionTable.PSVersion.ToString() $datetime = Get-Date -F 'yyyyMMddHHmmss' $filename = "Transcript-${username}-${hostname}-${version}-${datetime}.txt" $Transcript = (Join-Path -Path $sharePath -ChildPath $filename).ToString() Start-TranscriptIdentify

Start a transcript using a relative path on Windows systems

Start-Transcript -Path .\transcriptsIdentify

Its page in the reference: Start-Transcript.

Parameters

9 in the PowerShell reference
-AppendIndicates that this cmdlet adds the new transcript to the end of an existing file. Use the Path parameter to specify the file.
-ForceAllows the cmdlet to append the transcript to an existing read-only file. When used on a read-only file, the cmdlet changes the file permission to read-write. The cmdlet can't override security restrictions when this parameter is used.
-IncludeInvocationHeaderIndicates that this cmdlet logs the time stamp when commands are run.
-LiteralPathSpecifies a location to the transcript file. Unlike the Path parameter, the value of the LiteralPath parameter is used exactly as it's typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks inform PowerShell not to interpret any characters as escape sequences.
-NoClobberIndicates that this cmdlet doesn't overwrite an existing file. By default, if a transcript file exists in the specified path, Start-Transcript overwrites the file without warning.
-OutputDirectorySpecifies a specific path and folder in which to save a transcript. PowerShell automatically assigns the transcript name. If you use a relative path, the path is relative to your Documents directory on Windows.
-PathSpecifies a location to the transcript file. Enter a path to a .txt file. Wildcards aren't permitted. If any of the directories in the path don't exist, the command fails. If you don't specify a path, Start-Transcript uses the path in the value of the $Transcript global variable. If you haven't created this variable, Start-Transcript stores the transcripts in the default location and filename.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet isn't run.