Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Start-Transcript

Start-Transcript

microsoft.powershell.consolehost.dll

Synopsis

Creates a record of all or part of a Windows PowerShell session in a text file.

Syntax

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

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

Detailed Description

The Start-Transcript cmdlet creates a record of all or part of a Windows PowerShell session in a text file. The transcript includes all command that the user types and all output that appears on the console.

Starting in Windows PowerShell 5.0, Start-Transcript includes the host name in the generated file name of all transcripts. This is especially useful when your enterprise’s logging is centralized. Files that are created by Start-Transcript include random characters in names to prevent overwriting or duplication when two or more transcripts are started nearly simultaneously, and to help prevent unauthorized discovery of transcripts that are stored in a centralized file share. Additionally in Windows PowerShell 5.0, the Start-Transcript cmdlet works in Windows PowerShell ISE.

Parameters

-Append <SwitchParameter>

Adds the new transcript to the end of an existing file. Use the Path parameter to specify the file.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Force <SwitchParameter>

Allows 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. Even using the Force parameter, the cmdlet cannot override security restrictions.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-IncludeInvocationHeader <SwitchParameter>

Instructs Start-Transcript to log the time stamp when commands are run.

Aliases

none

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-NoClobber <SwitchParameter>

Will not overwrite (replace the contents) of an existing file. By default, if a transcript file exists in the specified path, Start-Transcript overwrites the file without warning.

Aliases

NoOverwrite

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-OutputDirectory <String>

Specifies a specific path and folder in which to save a transcript. Windows PowerShell assigns the transcript name.

Aliases

none

Required?

false

Position

named

Default value

none

Accept pipeline input?

false

Accept wildcard characters?

false

-Path <String>

Specifies a location for the transcript file. Enter a path to a .txt file. Wildcards are not permitted.

If you do not specify a path, Start-Transcript uses the path in the value of the $Transcript global variable. If you have not created this variable, Start-Transcript stores the transcripts in the $Home\My Documents directory as \PowerShell_transcript.<time-stamp>.txt files.

If any of the directories in the path do not exist, the command fails.

Aliases

None

Required?

false

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-LiteralPath <String>

Specifies a location for the transcript file. Unlike Path, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

Aliases

None

Required?

false

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

None

Return Type

System.String

Notes

To stop a transcript, use the Stop-Transcript cmdlet.

To record an entire session, add the Start-Transcript command to your profile. For more information, see about_Profiles.

Examples

-------------------------- EXAMPLE 1 --------------------------

This command starts a transcript in the default file location.

PS C:\>start-transcript

-------------------------- EXAMPLE 2 --------------------------

This command starts a transcript in the Transcript0.txt file in C:\transcripts. The NoClobber parameter prevents any existing files from being overwritten. If the Transcript0.txt file already exists, the command fails.

PS C:\>start-transcript -path c:\transcripts\transcript0.txt -noclobber

Online Version
Stop-Transcript