Skip to content
ConsoleMonster
Cmdlet

New-ConsoleProgress

Module
ConsoleMonster
Outputs
ConsoleMonster.Widgets.ProgressBar ConsoleMonster.Widgets.Spinner

Creates a progress bar or an indeterminate activity indicator.

Syntax

New-ConsoleProgress
[-Columns <Object[]>]
[-CountColumn <ColumnFormat>]
[[-Label] <Object>]
[-LabelWidth <Int32>]
[-NoCount]
[-RateWindowSeconds <Double>]
[-Shape <Block|Line>]
[-Status <StatusKind>]
[-Total <Double>]
[-Value <Double>]
[[-WidgetId] <String>]
[<CommonParameters>]
#
Parameter set: Bar
New-ConsoleProgress
[-Detail <Object>]
[-FinishedSeconds <Double>]
-Indeterminate
[[-Label] <Object>]
[-NoElapsed]
[-StartedSeconds <Double>]
[-Status <StatusKind>]
[[-WidgetId] <String>]
[<CommonParameters>]
#
Parameter set: Indeterminate

Description

The default bar represents a known total. Indeterminate creates a spinner. Update either through Update-Console. Structural parameter sets reject bar-only options on a spinner and spinner-only options on a bar; the shared C# Progress factory validates the same contract.

Examples

Example 1

$progressOptions = @{
    Label = 'Upload'
    Value = 64
    Total = 100
}
New-ConsoleProgress @progressOptions | Show-Console

Show completed work

Example 2

$progressOptions = @{
    Indeterminate = $true
    WidgetId = 'resolve'
    Label = 'Resolving DNS'
    Detail = 'zone 4'
}
New-ConsoleProgress @progressOptions | Show-Console

Show work with no known total

Example 3

Get-ConsoleDemo -Slug 'build-steps' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'pipeline' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'worker-progress' | Select-Object -ExpandProperty Source

Read any of these gallery scripts to see New-ConsoleProgress in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.

Parameters

-Columns Object[] optionalsets: Bar
Ordered builtin column names, Type/Alignment/Priority/MaxWidth records or typed ProgressColumn objects.
-CountColumn ColumnFormat optionalsets: Bar
The shared count column format.
-Label Object optionalposition: 1
The activity label, including markup.
-LabelWidth Int32 optionalsets: Bar
The fixed label width.
-NoCount SwitchParameter optionalsets: Bar
Shows a percentage instead of value/total for totals other than 100. A total of 100 always shows only its percentage.
-RateWindowSeconds Double optionalsets: Bar
Rate smoothing window in seconds; default ten.
-Shape BarShape optionalsets: Bar
The progress bar shape; default Line.
Possible values: Block, Line
-Status StatusKind optional
The initial state; default Running.
Possible values: Pending, Running, Pass, Fail, Warn, Skip, Info, Unknown, Error, Investigate, NotRun
-Total Double optionalsets: Bar
The planned total; default 100.
-Value Double optionalsets: Bar
The completed value; default zero.
-WidgetId String optionalposition: 0
The live identifier; default progress, or spinner with Indeterminate.
-Detail Object optionalsets: Indeterminate
The muted indeterminate activity detail.
-FinishedSeconds Double optionalsets: Indeterminate
Initial indeterminate completion time on the session clock, in seconds.
-Indeterminate SwitchParameter requiredsets: Indeterminate
Creates a spinner for work without a known total.
-NoElapsed SwitchParameter optionalsets: Indeterminate
Hides the default-on indeterminate elapsed time.
-StartedSeconds Double optionalsets: Indeterminate
Initial indeterminate start time on the session clock, in seconds.

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.