New-ConsoleProgress
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>]#BarNew-ConsoleProgress
[-Detail <Object>]
[-FinishedSeconds <Double>]
-Indeterminate
[[-Label] <Object>]
[-NoElapsed]
[-StartedSeconds <Double>]
[-Status <StatusKind>]
[[-WidgetId] <String>]
[<CommonParameters>]#IndeterminateDescription
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-ConsoleShow completed work
Example 2
$progressOptions = @{
Indeterminate = $true
WidgetId = 'resolve'
Label = 'Resolving DNS'
Detail = 'zone 4'
}
New-ConsoleProgress @progressOptions | Show-ConsoleShow 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 SourceRead 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[]
- Ordered builtin column names, Type/Alignment/Priority/MaxWidth records or typed ProgressColumn objects.
- -CountColumn ColumnFormat
- The shared count column format.
- -Label Object
- The activity label, including markup.
- -LabelWidth Int32
- The fixed label width.
- -NoCount SwitchParameter
- Shows a percentage instead of value/total for totals other than 100. A total of 100 always shows only its percentage.
- -RateWindowSeconds Double
- Rate smoothing window in seconds; default ten.
- -Shape BarShape
- The progress bar shape; default Line.
- Possible values:
Block,Line - -Status StatusKind
- The initial state; default Running.
- Possible values:
Pending,Running,Pass,Fail,Warn,Skip,Info,Unknown,Error,Investigate,NotRun - -Total Double
- The planned total; default 100.
- -Value Double
- The completed value; default zero.
- -WidgetId String
- The live identifier; default progress, or spinner with Indeterminate.
- -Detail Object
- The muted indeterminate activity detail.
- -FinishedSeconds Double
- Initial indeterminate completion time on the session clock, in seconds.
- -Indeterminate SwitchParameter
- Creates a spinner for work without a known total.
- -NoElapsed SwitchParameter
- Hides the default-on indeterminate elapsed time.
- -StartedSeconds Double
- 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.