Skip to content
ConsoleMonster
Cmdlet

Invoke-ConsoleRecording

Module
ConsoleMonster
Inputs
None
Outputs
System.IO.FileInfo

Records a script in a child PowerShell terminal and exports the result.

Syntax

Invoke-ConsoleRecording
[-ChromeStyle <MacOS|Windows|Linux>]
-Destination <String>
[-FinalFrame]
[-Folder <String>]
[-Height <Int32>]
[-IdleLimit <Double>]
[-InProcess]
[-MaxBytes <Int64>]
[-Name <String>]
[-Path <String>]
[-Redact <String[]>]
[-RedactionText <String>]
[-ScriptBlock] <ScriptBlock>
[-Shell <String>]
[-Theme <Auto|Dark|Light>]
[-TimeoutSeconds <Int32>]
[-Width <Int32>]
[-WindowChrome]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Runs the script in an isolated child process. Caller variables and functions are not inherited. The selected shell must be pwsh or powershell. Saves a local v2 cast plus metadata, then uses the existing renderer for an HTML player, animated SVG, text, Markdown or a final-frame SVG. -InProcess explicitly selects the limited PowerShell output fallback.

Examples

Example 1

Invoke-ConsoleRecording { Add-ConsoleRecordingMarker 'Build'; git --version; Write-Host 'Done' -ForegroundColor Green } -Destination ./demo.html

Record native coloured output and a chapter

Parameters

-ChromeStyle WindowChromeStyle optional
MacOS (default), Windows, Linux or None. None or -WindowChrome:$false hides chrome.
Possible values: MacOS, Windows, Linux
-Destination String required
Export path. Extension selects HTML, SVG, cast, text or Markdown.
-FinalFrame SwitchParameter optional
Export the final frame as a static SVG.
-Folder String optional
Folder for automatic cast names.
-Height Int32 optional
Initial terminal height in cells.
-IdleLimit Double optional
Longest playback idle gap in seconds; zero keeps original timing.
-InProcess SwitchParameter optional
Explicit limited fallback: PowerShell host output in this process; no native terminal capture.
-MaxBytes Int64 optional
Maximum cast bytes. At the cap recording stops with a warning.
-Name String optional
Recording title.
-Path String optional
Local asciicast v2 output; omitted names are timestamped.
-Redact String[] optional
Additional regular expressions to redact from recorded output.
-RedactionText String optional
Visible replacement for matched output (default [REDACTED]). No control characters.
-ScriptBlock ScriptBlock requiredposition: 0
Script to run in the recorded PowerShell child.
-Shell String optional
Shell executable. The default is the current PowerShell executable.
-Theme ExportTheme optional
Export colours.
Possible values: Auto, Dark, Light
-TimeoutSeconds Int32 optional
Maximum child lifetime in seconds.
-Width Int32 optional
Initial terminal width in cells.
-WindowChrome SwitchParameter optional
Draws a title bar (default true). Use -WindowChrome:$false to hide it.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.