Skip to content
ConsoleMonster
Cmdlet

New-ConsoleActivityList

Module
ConsoleMonster
Outputs
ConsoleMonster.Widgets.ActivityList

Creates an activity list: the work in progress right now, one row per activity, with a spinner or a bar and the time it has taken.

Syntax

New-ConsoleActivityList
[-MaxVisible <Int32>]
[-NoElapsed]
[-ShowIds]
[[-WidgetId] <String>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Each activity has an id, a title, an optional status, a percentage (or none, which spins) and an optional parent it is indented under; finished activities disappear, and an empty list takes no space. Update it with Update-Console from the script of a running dashboard or menu run. -MaxVisible caps the rows (more are summed up in one line). The default name, $progress, is also where Write-Progress goes in Invoke-ConsoleDashboard, so a list with that name shows the script's progress records; give another name for activities of your own.

Examples

Example 1

$dashboardOptions2 = @{
    Title = 'Checks'
    Content = {
        $panelOptions = @{
            Title = 'Running'
            Content = {
                $activityListOptions = @{
                    WidgetId = 'running'
                    MaxVisible = 4
                }
                New-ConsoleActivityList @activityListOptions
            }
        }
        New-ConsolePanel @panelOptions
    }
}
$dashboard = New-ConsoleDashboard @dashboardOptions2
$dashboardOptions = @{
    Dashboard = $dashboard
    ScriptBlock = {
        $updateConsoleOptions2 = @{
            WidgetId = 'running'
            Key = 1
            Label = 'SRV01 · Free space'
        }
        Update-Console @updateConsoleOptions2
        Start-Sleep -Seconds 1
        $updateConsoleOptions = @{
            Complete = $true
            WidgetId = 'running'
            Key = 1
        }
        Update-Console @updateConsoleOptions
    }
}
Invoke-ConsoleDashboard @dashboardOptions

The checks running on four workers

Example 2

$dashboardOptions2 = @{
    Title = 'Inventory'
    Content = { New-ConsoleActivityList -MaxVisible 3 }
}
$dashboard = New-ConsoleDashboard @dashboardOptions2
$dashboardOptions = @{
    Dashboard = $dashboard
    ScriptBlock = {
        Write-Progress -Activity 'Inspect web01' -Status 'Reading inventory' -PercentComplete 50
        Wait-ConsoleDashboard -Seconds 0.2
    }
}
Invoke-ConsoleDashboard @dashboardOptions

Limit the number of visible live activities

Parameters

-MaxVisible Int32 optional
The most activities shown (default 8); more are summed up in one line.
-NoElapsed SwitchParameter optional
Leaves out the time each activity has taken at the end of its row.
-ShowIds SwitchParameter optional
Starts each row with the activity's id (#3), for parallel work.
-WidgetId String optionalposition: 0
The live name used by Update-Console (default $progress, where Write-Progress also goes in Invoke-ConsoleDashboard).

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.