Start-ConsoleDashboard
Runs a console dashboard live while a script does the work.
Syntax
Start-ConsoleDashboard [-ArgumentList <Object[]>] [-AutoRecord <Int32>] [-Dashboard] <IWidget> [-FramesPerSecond <Int32>] [-ImportModule <String[]>] [-Inline] [-InputObject <Object>] [-Parallel] [-RecordPath <String>] [-ScriptBlock] <ScriptBlock> [-Summary <IWidget>] [-ThrottleLimit <Int32>] [-Transient] [<CommonParameters>]#All Parameter SetsDescription
Runs a console dashboard live while a script does the work.
The script runs in a runspace the module owns (or, with -Parallel, once per input item on a runspace pool, started as items arrive and limited by -ThrottleLimit). Inside it, $ConsoleSession and the Update-ConsoleLane, Update-ConsolePhase, Write-ConsoleLog and related cmdlets update the screen; Write-Host, Write-Warning, Write-Verbose, errors and Console.WriteLine go to the dashboard's log region instead of scribbling over the screen. The screen is redrawn at about 15 frames per second however many updates arrive. Ctrl+C stops the script and always restores the terminal; the dashboard then leaves the alternate screen and prints its final state (or -Summary). Script output is returned when the dashboard ends. In redirected or CI output the dashboard becomes append-only lines. Variables from the caller are not visible inside the script: pass them with -ArgumentList and a param() block.
Examples
EXAMPLE 1
Start-ConsoleDashboard -Dashboard 'Value' -ScriptBlock { }Parameters
- -ArgumentList Object[]
- Arguments passed to the script (after the input item with -Parallel).
- -AutoRecord Int32
- Records the run automatically to the local ConsoleMonster\Recordings folder and keeps only this many recent runs (within 50 MB together), for Show-ConsoleReplay. Ignored with -RecordPath.
- -Dashboard IWidget
- The dashboard from New-ConsoleDashboard (or any widget tree).
- -FramesPerSecond Int32
- Redraw rate (default 15).
- -ImportModule String[]
- Modules to import into the dashboard runspaces.
- -Inline SwitchParameter
- Draws the dashboard inline, below the cursor, instead of on the alternate screen: output and log lines scroll above it and the final state stays in the scrollback.
- -InputObject Object
- Items processed with -Parallel; each item is the script's first argument.
- -Parallel SwitchParameter
- Run the script once per input item on a runspace pool.
- -RecordPath String
- Record every update as JSON lines for Start-ConsoleReplay.
- -ScriptBlock ScriptBlock
- The work to run while the dashboard is live.
- -Summary IWidget
- A widget printed to scrollback after the dashboard ends (default: the dashboard's final state).
- -ThrottleLimit Int32
- Maximum concurrent runspaces with -Parallel (default 4).
- -Transient SwitchParameter
- Leaves nothing behind when the dashboard ends (no final state in the scrollback).
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.