New-ConsoleSummaryBar
Creates a summary bar: one line with progress, done of total, the time left and result counters.
Syntax
New-ConsoleSummaryBar
[-BarWidth <Int32>]
[-Counter <IDictionary>]
[-DoneLabel <String>]
[-ElapsedSeconds <Double>]
[-NoElapsed]
[[-Total] <Double>]
[[-Value] <Double>]
[[-WidgetId] <String>]
[<CommonParameters>]#All Parameter SetsDescription
The line Invoke-ConsoleRun ends its view with, as a widget of its own: a thin bar, done of total, the percentage, the time left (estimated from -ElapsedSeconds and the share done) and counters in a fixed order with zeros dimmed rather than hidden. -Counter maps labels to counts; a label that is a status word (passed, failed, warnings, skipped, running) takes that status's symbol and colour. Without -Total only the count done shows.
Examples
Example 1
$summaryBarOptions = @{
Value = 30
Total = 40
ElapsedSeconds = 42
Counter = ([ordered] @{ passed = 27; failed = 2; skipped = 1 })
}
New-ConsoleSummaryBar @summaryBarOptions | Show-ConsoleA run three quarters through
Example 2
$summaryBarOptions = @{
Total = 12
Value = 9
Counter = ([ordered]@{ passed = 8; warnings = 1 })
}
New-ConsoleSummaryBar @summaryBarOptions | Show-ConsoleSummarize completed inventory checks
Example 3
Get-ConsoleDemo -Slug 'parallel-patch' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'toolbox' | Select-Object -ExpandProperty SourceRead any of these gallery scripts to see New-ConsoleSummaryBar in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.
Parameters
- -BarWidth Int32
- The bar width in cells (default 20; narrow space shrinks it).
- -Counter IDictionary
- Labels mapped to counts, in the order to show them; status words (passed, failed, skipped...) take their status symbol and colour.
- -DoneLabel String
- Custom completed-count label; omitted uses the localized default.
- -ElapsedSeconds Double
- Elapsed seconds used to estimate remaining time. Fractional seconds are accepted.
- -NoElapsed SwitchParameter
- Hides the elapsed and remaining duration.
- -Total Double
- Items in total (0 = unknown: no bar, percentage or time left).
- -Value Double
- Initial number of completed items, displayed relative to Total.
- -WidgetId String
- The live name (default summary).
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.