New-ConsoleStatusList
Creates a checklist of items with status markers.
Syntax
New-ConsoleStatusList
[[-Content] <ScriptBlock>]
[-DetailColumn <ColumnFormat>]
[-FanOut <Int32>]
[[-InputObject] <PSObject>]
[-Layout <List| Strip| Chain>]
[-StepCounter]
[[-WidgetId] <String>]
[<CommonParameters>]#All Parameter SetsDescription
Content or the pipeline accepts Key/Label/Status records and strings. Records can include Detail; strings begin as pending checklist items. InputObject also accepts a dictionary mapping labels to statuses. Layout selects a vertical List, a horizontal Strip of phases, or a Chain: the phases on one line that folds to fit, for a table cell or a header. In a Strip, records with ParentKey are items of that phase; the running phase fans out to them, prioritizing failed, warning and running items within FanOut rows and counting the remaining items in +N more. The summary uses one row, so urgent items can also be folded when they exceed the limit. Statuses use the shared vocabulary: Pass, Fail, Warn, Skip, Info, Running, Pending and PowerShell's words such as Success, Warning and Error. Status is always shown with a symbol (or a [PASS]-style word in ASCII mode), never by colour alone. In a live dashboard, update items with Update-Console.
Examples
Example 1
New-ConsoleStatusList -Content {
[pscustomobject]@{ Label = 'Restore NuGet packages'; Status = 'Pass'; Detail = '1.6 s' }
[pscustomobject]@{ Label = 'Compile ConsoleMonster'; Status = 'Pass'; Detail = '4.7 s' }
[pscustomobject]@{ Label = 'Run Pester on PowerShell 7'; Status = 'Warn'; Detail = '1 skipped' }
[pscustomobject]@{ Label = 'Pack ConsoleMonster.2.0.0.nupkg'; Status = 'Running' }
} | Show-ConsoleA build checklist
Example 2
New-ConsoleStatusList -InputObject ([ordered] @{ 'SPF valid' = 'pass'; 'DMARC enforced' = 'pass'; 'MTA-STS' = 'warn' }) | Show-ConsoleMail security checks from a hashtable
Example 3
$checks = [pscustomobject]@{ Name = 'Build'; Result = 'Pass'; Duration = '2 s' }; $checks | ForEach-Object { [pscustomobject]@{ Label = $_.Name; Status = $_.Result; Detail = $_.Duration } } | New-ConsoleStatusList | Show-ConsoleItems from objects in the pipeline
Example 4
$steps = 'Scan files', 'Copy changes', 'Verify' | New-ConsoleStatusList -WidgetId status
$dashboardOptions = @{
Dashboard = (New-ConsoleDashboard -Title 'Backup' -Content { $steps })
ScriptBlock = {
$updateConsoleOptions = @{
WidgetId = 'status'
Key = 'Scan files'
Status = 'Pass'
Detail = '2.4 s'
}
Update-Console @updateConsoleOptions
}
}
Invoke-ConsoleDashboard @dashboardOptionsA live checklist: items start pending and are updated from the dashboard script
Example 5
$statusListOptions = @{
StepCounter = $true
Layout = 'Strip'
Content = {
@{ Key = 'restore'; Label = 'Restore'; Status = 'Pass' }
@{ Key = 'build'; Label = 'Build'; Status = 'Running' }
@{ Key = 'test'; Label = 'Test'; Status = 'Pending' }
}
}
New-ConsoleStatusList @statusListOptions | Show-ConsoleShow build phases as a compact strip
Example 6
$statusListOptions = @{
Layout = 'Strip'
FanOut = 4
Content = {
@{ Key = 'snapshot'; Label = 'Snapshot'; Status = 'Pass'; Detail = '12 s' }
@{ Key = 'migrate'; Label = 'Migrate'; Status = 'Running'; Detail = '6/14' }
@{ Key = 'verify'; Label = 'Verify' }
'alice', 'bob', 'carol', 'dave', 'erin' | ForEach-Object { @{ ParentKey = 'migrate'; Key = $_; Status = 'Pass' } }
@{ ParentKey = 'migrate'; Key = 'frank'; Status = 'Running'; Detail = '40%' }
@{ ParentKey = 'migrate'; Key = 'mallory'; Status = 'Fail'; Detail = 'access denied' }
}
}
New-ConsoleStatusList @statusListOptions | Show-ConsoleThe running phase fans out to the users it is migrating
Example 7
$stages = { param($Build)
$statusListOptions = @{
Layout = 'Chain'
Content = {
@{ Key = 'fetch'; Label = 'Fetch'; Status = 'Pass' }
@{ Key = 'build'; Label = 'Build'; Status = $Build }
@{ Key = 'test'; Label = 'Test' }
}
}
New-ConsoleStatusList @statusListOptions
}
@(
[pscustomobject]@{ Repository = 'ConsoleMonster'; Stages = & $stages 'Running' }
[pscustomobject]@{ Repository = 'PSPublishModule'; Stages = & $stages 'Fail' }
) | Show-ConsoleTablePipeline stages as one line in a table column
Example 8
Get-ConsoleDemo -Slug 'repository-status' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'certificate-expiry' | Select-Object -ExpandProperty SourceRead any of these gallery scripts to see New-ConsoleStatusList in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.
Parameters
- -Content ScriptBlock
- A script block that emits the items: Key/Label/Status records calls or hashtables with Label, Status and Detail.
- -DetailColumn ColumnFormat
- Shared DetailColumn layout settings as a hashtable, for example @{ MinWidth = 6; Alignment = 'Right' }.
- -FanOut Int32
- Rows the running phase of a Strip fans out to, including the +N more row (default 5; 0 hides items).
- -InputObject PSObject
- Items from the pipeline: Key/Label/Status records objects or hashtables with Label, Status and Detail.
- -Layout String
- List stacks the items; Strip shows ordered phases; Chain shows the phases on one line that folds to fit.
- Possible values:
List,Strip,Chain - -StepCounter SwitchParameter
- Shows Strip phases as a numbered ledger. ParentKey items require Strip without StepCounter.
- -WidgetId String
- The live name (default status).
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.