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