New-ConsoleCellMap
Creates a cell map: one status symbol per item of a run, with a legend of counts.
Syntax
New-ConsoleCellMap
[-Blocks]
[-Columns <Int32>]
[-Count <Int32>]
[-Gap <Int32>]
[[-InputObject] <Object[]>]
[-LegendLines <Int32>]
[-MaxRows <Int32>]
[-NoLegend]
[-NoSpinRunning]
[-RowLabels <String[]>]
[[-WidgetId] <String>]
[-Window <Head| Active>]
[<CommonParameters>]#All Parameter SetsDescription
The map Invoke-ConsoleRun shows for many items, as a widget of its own: each item is one cell in its status colour (pass, fail, warn, skip, running, pending), wrapping to the width, followed by a legend with each state's count. States come from -InputObject or the pipeline, in the shared status vocabulary (PowerShell's words such as Success and Error work too). -Count adds pending cells for items not started yet. -Columns and -RowLabels turn it into a labelled grid (one row per server, one column per check) with one legend below, which -LegendLines lets wrap. In a live dashboard, update cells with Update-Console.
Examples
Example 1
$states = @('Pass') * 28 + @('Fail') * 2 + @('Warn') + @('Running') * 4
$cellMapOptions = @{
InputObject = $states
Count = 40
}
New-ConsoleCellMap @cellMapOptions | Show-ConsoleForty items part-way through a run
Example 2
@([pscustomobject]@{ Result = 'Pass' }, [pscustomobject]@{ Result = 'Warn' }) | ForEach-Object Result | New-ConsoleCellMap | Show-ConsoleStates from objects
Example 3
$cellMapOptions = @{
WidgetId = 'checks'
Count = 12
Columns = 4
RowLabels = @('SRV01', 'SRV02', 'SRV03')
LegendLines = 2
InputObject = @('Pass', 'Pass', 'Fail', 'Warn', 'Pass')
}
New-ConsoleCellMap @cellMapOptions | Show-ConsoleA grid of three servers by four checks, with the server names beside the rows
Example 4
Get-ConsoleDemo -Slug 'fleet' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'parallel-patch' | Select-Object -ExpandProperty SourceRead any of these gallery scripts to see New-ConsoleCellMap in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.
Parameters
- -Blocks SwitchParameter
- Draws each cell as a block in its state's colour, for a dense strip of many items (use with -Gap 0). Without colour, or on the ASCII tier, the cells keep their symbols.
- -Columns Int32
- The cells per row (0 = as many as fit). Set it to draw a grid, such as one row per server and one column per check; cells past the width are cut off rather than moved to the next row.
- -Count Int32
- The total number of items; cells beyond the given states are pending.
- -Gap Int32
- Space between cells; default one column.
- -InputObject Object[]
- The item states, in order: Pass, Fail, Warn, Skip, Info, Running or Pending (pipeline input works too).
- -LegendLines Int32
- The most lines the legend wraps onto when it is wider than the map (default 1: it is cut off instead).
- -MaxRows Int32
- The most rows of cells (0 = all); a last line counts the items not shown.
- -NoLegend SwitchParameter
- Hide the legend line with each state's count.
- -NoSpinRunning SwitchParameter
- Uses a fixed running marker instead of a spinner.
- -RowLabels String[]
- Labels drawn muted before the rows, one per row in order; the cells start after the widest label. With -Columns they make a labelled grid with one legend below it.
- -WidgetId String
- The live name (default cells).
- -Window CellWindow
- Chooses which cells remain visible when MaxRows limits the map.
- Possible values:
Head,Active
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.