Skip to content
ConsoleMonster

Help, errors and progress

Show PowerShell help, errors, progress and native stream colours with ConsoleMonster.

These features change how PowerShell's own output looks for the session, never what commands return. Disable-ConsoleFormatting restores the session.

Enable-ConsoleFormatting enables Output, FormatCommands, Errors, Streams and ReadLine. Explicit Format-Table, Format-List and Format-Wide retain PowerShell's column choices and only change output sent straight to the console. Use -Include Help to add an opt-in and -Exclude FormatCommands to keep those commands native. For an explicit view, use Show-ConsoleTable or Show-ConsoleObject.

  1. Choose the default set or individual features:

    Import-Module ConsoleMonster
    Enable-ConsoleFormatting                            # everyday defaults
    Get-ConsoleFormatting                               # see what is enabled
    Enable-ConsoleFormatting -Exclude FormatCommands    # keep native Format-* commands
    Enable-ConsoleFormatting -Exclude Output, FormatCommands, Errors # streams and ReadLine only
    Enable-ConsoleFormatting -ErrorLayout Compact       # opt in to compact errors
    Enable-ConsoleFormatting -Include Help              # opt in to styled help
    Enable-ConsoleFormatting -Include Progress          # opt in to the progress adapter
    Enable-ConsoleFormatting -Include Prompt            # opt in to the prompt
    
  2. To keep it on in every session, add the lines -ProfileSnippet prints to your profile. It only prints them; this appends them to $PROFILE, creating the file when there is none:

    if (-not (Test-Path -Path $PROFILE)) {
        $null = New-Item -ItemType File -Path $PROFILE -Force
    }
    Enable-ConsoleFormatting -ProfileSnippet | Add-Content -Path $PROFILE
    
  3. Open a new session. Disable-ConsoleFormatting turns it off again for a session; remove the lines from $PROFILE to stop it for good.

Help that reads like a page

Show-ConsoleHelp renders the help PowerShell already has, here a function's comment-based help: syntax, a parameter table and highlighted examples.

Show-ConsoleHelp 100×5024-bitFull
Install-Module ConsoleMonster -Scope CurrentUser
PowerShellhelp.ps1View on GitHub
# Show-ConsoleHelp reads the help PowerShell already has: here a function's comment-based help.
function Test-MailDomain {
    # … 29 more lines in the full program
}

Show-ConsoleHelp Test-MailDomain
Full program
Import-Module ConsoleMonster

# Show-ConsoleHelp reads the help PowerShell already has: here a function's comment-based help.
function Test-MailDomain {
    <#
    .SYNOPSIS
    Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS.

    .DESCRIPTION
    Resolves each record, compares it with the recommended settings and returns one result per check.

    .PARAMETER Domain
    The domain to check, for example evotec.xyz.

    .PARAMETER Selector
    The DKIM selectors to look up.

    .PARAMETER Timeout
    How long to wait for each DNS answer.

    .EXAMPLE
    Test-MailDomain -Domain evotec.xyz

    .EXAMPLE
    'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable
    #>
    [CmdletBinding()]
    param(
        [Parameter(Mandatory, ValueFromPipeline)][string] $Domain,
        [string[]] $Selector = @('selector1'),
        [timespan] $Timeout = (New-TimeSpan -Seconds 5)
    )
    process { [pscustomobject] @{ Domain = $Domain; Checks = 5 } }
}

Show-ConsoleHelp Test-MailDomain

Run: pwsh ./help.ps1

C#help.host.csView on GitHub
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "HelpExample") ]
public sealed class HelpExample : PSCmdlet {
    protected override void ProcessRecord() {
        InvokeCommand.InvokeScript(@"function Test-MailDomain {
            <#
            .SYNOPSIS
            Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS.

            .DESCRIPTION
            Resolves each record, compares it with the recommended settings and returns one result per check.

            .PARAMETER Domain
            The domain to check, for example evotec.xyz.

            .PARAMETER Selector
            The DKIM selectors to look up.

            .PARAMETER Timeout
            How long to wait for each DNS answer.

            .EXAMPLE
            Test-MailDomain -Domain evotec.xyz

            .EXAMPLE
            'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable
            #>
            [CmdletBinding()]
            param(
                [Parameter(Mandatory, ValueFromPipeline)][string] $Domain,
                [string[]] $Selector = @('selector1'),
                [timespan] $Timeout = (New-TimeSpan -Seconds 5)
            )
            process { [pscustomobject] @{ Domain = $Domain; Checks = 5 } }
        }");
        if (ConsoleHostHelp.TryCreate("Test-MailDomain", InvokeCommand, out var widget,
            out var error) && widget != null) {
            Terminal.Write(widget);
        } else if (error != null) { WriteError(error); }
    }
}
Full program
using System.Management.Automation;
using ConsoleMonster;
using ConsoleMonster.PowerShell;

// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "HelpExample") ]
public sealed class HelpExample : PSCmdlet {
    protected override void ProcessRecord() {
        InvokeCommand.InvokeScript(@"function Test-MailDomain {
            <#
            .SYNOPSIS
            Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS.

            .DESCRIPTION
            Resolves each record, compares it with the recommended settings and returns one result per check.

            .PARAMETER Domain
            The domain to check, for example evotec.xyz.

            .PARAMETER Selector
            The DKIM selectors to look up.

            .PARAMETER Timeout
            How long to wait for each DNS answer.

            .EXAMPLE
            Test-MailDomain -Domain evotec.xyz

            .EXAMPLE
            'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable
            #>
            [CmdletBinding()]
            param(
                [Parameter(Mandatory, ValueFromPipeline)][string] $Domain,
                [string[]] $Selector = @('selector1'),
                [timespan] $Timeout = (New-TimeSpan -Seconds 5)
            )
            process { [pscustomobject] @{ Domain = $Domain; Checks = 5 } }
        }");
        if (ConsoleHostHelp.TryCreate("Test-MailDomain", InvokeCommand, out var widget,
            out var error) && widget != null) {
            Terminal.Write(widget);
        } else if (error != null) { WriteError(error); }
    }
}

Download HostExample.csproj beside the source file.

PowerShell 7
Import-Module ConsoleMonster
$moduleBinary = Split-Path (Get-Command Show-Console).DLL
dotnet build ./HostExample.csproj -c Release "-p:ConsoleMonsterModuleDirectory=$moduleBinary"
Import-Module ./bin/Release/net8.0/HostExample.dll
Invoke-HelpExample

This is a compiled PowerShell cmdlet class. Reference the installed module’s ConsoleMonster and ConsoleMonster.PowerShell assemblies in a PowerShell module project; ProcessRecord runs on the owning pipeline thread. Download the project beside the source file and build/run it from PowerShell 7.

C# fluenthelp.host.cs
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "HelpExample")]
public sealed class HelpExample : PSCmdlet
{
    protected override void ProcessRecord()
    {
        InvokeCommand.InvokeScript(@"function Test-MailDomain {
            <#
            .SYNOPSIS
            Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS.

            .DESCRIPTION
            Resolves each record, compares it with the recommended settings and returns one result per check.

            .PARAMETER Domain
            The domain to check, for example evotec.xyz.

            .PARAMETER Selector
            The DKIM selectors to look up.

            .PARAMETER Timeout
            How long to wait for each DNS answer.

            .EXAMPLE
            Test-MailDomain -Domain evotec.xyz

            .EXAMPLE
            'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable
            #>
            [CmdletBinding()]
            param(
                [Parameter(Mandatory, ValueFromPipeline)][string] $Domain,
                [string[]] $Selector = @('selector1'),
                [timespan] $Timeout = (New-TimeSpan -Seconds 5)
            )
            process { [pscustomobject] @{ Domain = $Domain; Checks = 5 } }
        }");
        if (ConsoleHostHelp.TryCreate("Test-MailDomain", InvokeCommand, out var widget,
            out var error) && widget != null)
        {
            widget.Show();
        }
        else if (error != null)
        {
            WriteError(error);
        }
    }
}
Full program
using System.Management.Automation;
using ConsoleMonster;
using ConsoleMonster.PowerShell;

// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "HelpExample")]
public sealed class HelpExample : PSCmdlet
{
    protected override void ProcessRecord()
    {
        InvokeCommand.InvokeScript(@"function Test-MailDomain {
            <#
            .SYNOPSIS
            Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS.

            .DESCRIPTION
            Resolves each record, compares it with the recommended settings and returns one result per check.

            .PARAMETER Domain
            The domain to check, for example evotec.xyz.

            .PARAMETER Selector
            The DKIM selectors to look up.

            .PARAMETER Timeout
            How long to wait for each DNS answer.

            .EXAMPLE
            Test-MailDomain -Domain evotec.xyz

            .EXAMPLE
            'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable
            #>
            [CmdletBinding()]
            param(
                [Parameter(Mandatory, ValueFromPipeline)][string] $Domain,
                [string[]] $Selector = @('selector1'),
                [timespan] $Timeout = (New-TimeSpan -Seconds 5)
            )
            process { [pscustomobject] @{ Domain = $Domain; Checks = 5 } }
        }");
        if (ConsoleHostHelp.TryCreate("Test-MailDomain", InvokeCommand, out var widget,
            out var error) && widget != null)
        {
            widget.Show();
        }
        else if (error != null)
        {
            WriteError(error);
        }
    }
}

Download HostExample.csproj beside the source file.

PowerShell 7
Import-Module ConsoleMonster
$moduleBinary = Split-Path (Get-Command Show-Console).DLL
dotnet build ./HostExample.csproj -c Release "-p:ConsoleMonsterModuleDirectory=$moduleBinary"
Import-Module ./bin/Release/net8.0/HostExample.dll
Invoke-HelpExample

This is a compiled PowerShell cmdlet class. Reference the installed module’s ConsoleMonster and ConsoleMonster.PowerShell assemblies in a PowerShell module project; ProcessRecord runs on the owning pipeline thread. Download the project beside the source file and build/run it from PowerShell 7.

Show-ConsoleHelp reads the help PowerShell has for a command (Get-Help -Full): cmdlet help files, comment-based help of functions and scripts, or the syntax PowerShell generates when there is none. It shows the synopsis, the syntax of each parameter set with optional parts told apart, the description, a parameter table, highlighted examples, inputs, outputs and links. Piped to more, Out-Host -Paging or a file, it writes plain lines.

Browse help like a document

Help you can browse

Long help opens in a document viewer: tabs for Overview, Parameters, Examples and Related, parameters that unfold to their details, Ctrl+K to go to one, find that opens the folded example holding a match, and a related command's help opened and left again.

Show-ConsoleHelp 100×3024-bitFull
Install-Module ConsoleMonster -Scope CurrentUser
PowerShellhelp-viewer.ps1View on GitHub
# Typed at an interactive prompt, help longer than the screen opens in the document viewer:
# tabs, an outline, folding sections, find (/), Ctrl+K to go to a parameter, and related commands.
function Test-MailDomain {
    # … 48 more lines in the full program
}

Show-ConsoleHelp Test-MailDomain
Full program
Import-Module ConsoleMonster

# Typed at an interactive prompt, help longer than the screen opens in the document viewer:
# tabs, an outline, folding sections, find (/), Ctrl+K to go to a parameter, and related commands.
function Test-MailDomain {
    <#
    .SYNOPSIS
    Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS.

    .DESCRIPTION
    Resolves each record, compares it with the recommended settings and returns one result per check.

    .PARAMETER Domain
    The domain to check, for example evotec.xyz.

    .PARAMETER Selector
    The DKIM selectors to look up.

    .PARAMETER Timeout
    How long to wait for each DNS answer.

    .PARAMETER Fix
    Writes the recommended records for the checks that fail.

    .EXAMPLE
    Test-MailDomain -Domain evotec.xyz

    Checks one domain with the default DKIM selector.

    .EXAMPLE
    'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable

    Checks two domains and both DKIM selectors, shown as one table.

    .EXAMPLE
    Test-MailDomain -Domain evotec.xyz -Fix -WhatIf

    Shows the records -Fix would write without writing them.

    .LINK
    Show-ConsoleTable

    .LINK
    https://consolemonster.dev/
    #>
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory, ValueFromPipeline)][string] $Domain,
        [string[]] $Selector = @('selector1'),
        [timespan] $Timeout = (New-TimeSpan -Seconds 5),
        [switch] $Fix
    )
    process { [pscustomobject] @{ Domain = $Domain; Checks = 5 } }
}

Show-ConsoleHelp Test-MailDomain

Run: pwsh ./help-viewer.ps1

Typed at an interactive prompt, help longer than the screen opens in the document viewer. A card at the top holds the synopsis with the module, version and -WhatIf badges, and tabs split the help into Overview, Parameters, Examples and Related. Each parameter is one row with its type, default and summary that unfolds to its details, each example is folded under its title, and related commands open their own help, with Backspace or Alt+← to return. An outline follows the reading position, / finds text and opens the sections that hold it, and Ctrl+K goes straight to a section or parameter. Every key has a mouse equivalent: click a tab, a heading, an outline entry or a link, and drag the divider. -NoPager prints the help instead; piped and redirected output is unchanged.

Use the view for native help

Enable-ConsoleFormatting -Include Help
Get-Help Get-Process -Full
Get-Process -?
help Get-Process -Examples
Disable-ConsoleFormatting -Feature Help

This opt-in feature uses the same view when native help goes straight to the console. help opens long help in the same document viewer; without virtual terminal support it pages with Space next · q quit in the footer. -Full, -Detailed, -Examples and -Parameter select the corresponding sections; -Online and -ShowWindow keep PowerShell's behavior. About topics use the Markdown reader, while captured output retains PowerShell's original text. Help is not enabled by default.

Pipelines, assignments, output variables, redirection, jobs, remoting, CI and transcripts keep PowerShell's own help objects and bytes. For example, Get-Help Get-Process | Out-String remains native while the feature is enabled. Disabling restores the previous help and output adapters. The contract suite records the proof for Windows PowerShell 5.1 and PowerShell 7.

Native Get-Help PowerShell 7120 columnsNative command
Get-Help with Help formatting PowerShell 7120 columnsNative command
Get-Help with Help formatting PowerShell 760 columnsNative command
PowerShellnative.ps1
Import-Module ConsoleMonster

Get-Help Get-ConsoleCapability
Full program
Import-Module ConsoleMonster

Get-Help Get-ConsoleCapability
PowerShellget-help.ps1
Import-Module ConsoleMonster

Enable-ConsoleFormatting -Include Help
Get-Help Get-ConsoleCapability
Full program
Import-Module ConsoleMonster

Enable-ConsoleFormatting -Include Help
Get-Help Get-ConsoleCapability
Native help before and after the opt-in, captured on PowerShell 7 at 120 and 60 columns.
help -Full · page position · Space next · b back · q quit PowerShell 7120 columnsFirst page
help -Full · page position · Space next · b back · q quit PowerShell 760 columnsFirst page
PowerShellhelp.ps1
Import-Module ConsoleMonster

Enable-ConsoleFormatting -Include Help
help Get-ConsoleCapability -Full
Full program
Import-Module ConsoleMonster

Enable-ConsoleFormatting -Include Help
help Get-ConsoleCapability -Full
Long help from help in the document viewer, at both widths.

Compact everyday errors

Enable the compact layout explicitly:

Enable-ConsoleFormatting -ErrorLayout Compact

Subsequent commands typed at the prompt use the new layout when they fail. This one deliberately produces an error:

[int]::Parse('production')

The message comes first, with only its label in the error tone. The original invocation is highlighted, a caret marks the failing span, and the script, line and column come from InvocationInfo. Category and target stay visible. Inner exceptions fold into a muted count, and PowerShell 7 adds a Get-Error for details hint.

Enable-ConsoleFormatting -CompactErrors
Enable-ConsoleFormatting -CompactErrors
PowerShellcompact.ps1
Enable-ConsoleFormatting -ErrorLayout Compact
try {
    # example-source-guard: intentional-error int.Parse production
    [int]::Parse('production')
} catch {
    $_ | Show-Console -ErrorLayout Compact -View Error
}
Disable-ConsoleFormatting -Feature Errors
Full program
Import-Module ConsoleMonster

Enable-ConsoleFormatting -ErrorLayout Compact
try {
    # example-source-guard: intentional-error int.Parse production
    [int]::Parse('production')
} catch {
    $_ | Show-Console -ErrorLayout Compact -View Error
}
Disable-ConsoleFormatting -Feature Errors
C#Program.cs
ExceptionInfo error = new("ItemNotFoundException",
    "Cannot load the inventory: the source file is missing.") {
    CommandName = "Get-Item",
    SourceLine = "Get-Item -LiteralPath './inventory.json'",
    ScriptPath = "deploy.ps1",
    LineNumber = 12,
    ColumnNumber = 1,
    ErrorLength = 38,
    Category = "ObjectNotFound",
    Target = "./inventory.json",
    ErrorId = "PathNotFound",
    Inner = new ExceptionInfo("IOException", "The inventory source is unavailable.") {
        Inner = new ExceptionInfo("Exception", "The source was removed.")
    }
};
Terminal.Write(new ExceptionView(error) {
    Compact = true,
    ShowStack = false,
    DetailsHint = "Get-Error for details"
});
Full program
using ConsoleMonster;
using ConsoleMonster.Widgets;

ExceptionInfo error = new("ItemNotFoundException",
    "Cannot load the inventory: the source file is missing.") {
    CommandName = "Get-Item",
    SourceLine = "Get-Item -LiteralPath './inventory.json'",
    ScriptPath = "deploy.ps1",
    LineNumber = 12,
    ColumnNumber = 1,
    ErrorLength = 38,
    Category = "ObjectNotFound",
    Target = "./inventory.json",
    ErrorId = "PathNotFound",
    Inner = new ExceptionInfo("IOException", "The inventory source is unavailable.") {
        Inner = new ExceptionInfo("Exception", "The source was removed.")
    }
};
Terminal.Write(new ExceptionView(error) {
    Compact = true,
    ShowStack = false,
    DetailsHint = "Get-Error for details"
});
C# fluentProgram.cs
ExceptionInfo error = new ExceptionInfo("ItemNotFoundException",
    "Cannot load the inventory: the source file is missing.")
{
    CommandName = "Get-Item",
    SourceLine = "Get-Item -LiteralPath './inventory.json'",
    ScriptPath = "deploy.ps1",
    LineNumber = 12,
    ColumnNumber = 1,
    ErrorLength = 38,
    Category = "ObjectNotFound",
    Target = "./inventory.json",
    ErrorId = "PathNotFound",
    Inner = new ExceptionInfo("IOException", "The inventory source is unavailable.")
    {
        Inner = new ExceptionInfo("Exception", "The source was removed.")
    }
};
new ExceptionView(error).Compact().ShowStack(false).DetailsHint("Get-Error for details").Show();
Full program
using ConsoleMonster;
using ConsoleMonster.Widgets;

ExceptionInfo error = new ExceptionInfo("ItemNotFoundException",
    "Cannot load the inventory: the source file is missing.")
{
    CommandName = "Get-Item",
    SourceLine = "Get-Item -LiteralPath './inventory.json'",
    ScriptPath = "deploy.ps1",
    LineNumber = 12,
    ColumnNumber = 1,
    ErrorLength = 38,
    Category = "ObjectNotFound",
    Target = "./inventory.json",
    ErrorId = "PathNotFound",
    Inner = new ExceptionInfo("IOException", "The inventory source is unavailable.")
    {
        Inner = new ExceptionInfo("Exception", "The source was removed.")
    }
};
new ExceptionView(error).Compact().ShowStack(false).DetailsHint("Get-Error for details").Show();
The shared compact view at 120 and 60 columns. Its complete C# program compiles to produce these frames; switch the site theme for the light rendering.
Enable-ConsoleFormatting -ErrorLayout Detailed  # include stacks and causes
Disable-ConsoleFormatting -Feature Errors

# The same view on demand, including inside a catch block or an export.
try { [int]::Parse('production') } catch { $_ | Show-Console -ErrorLayout Compact -View Error }

Compact errors are optional. Error-producing cmdlets remain native, and $Error, -ErrorVariable, 2>, try/catch, $? and $ErrorActionPreference keep their PowerShell behavior. Piped, assigned, redirected, job, remoting, CI and transcript output retains native rendering. $ErrorView stays unchanged; CategoryView and Get-Error retain their native views. Bare Disable-ConsoleFormatting removes this opt-in along with the others.

Errors you can read

The error view: the exception, the message, the category and the lines of the script around the failing statement.

Show-Console -View Error 59×324-bitFull
PowerShellerrors.ps1View on GitHub
# An explicit sample ErrorRecord: the same error view without machine-specific paths or stack frames.
$missing = New-Object IO.FileNotFoundException -ArgumentList 'The weekly report could not be loaded.',
    'Weekly-2026-43.pdf'
$problem = New-Object Management.Automation.ErrorRecord -ArgumentList $missing,
    'WeeklyReportMissing', 'ObjectNotFound', 'Weekly-2026-43.pdf'
$problem | Show-Console -NoStack -View Error
Full program
Import-Module ConsoleMonster

# An explicit sample ErrorRecord: the same error view without machine-specific paths or stack frames.
$missing = New-Object IO.FileNotFoundException -ArgumentList 'The weekly report could not be loaded.',
    'Weekly-2026-43.pdf'
$problem = New-Object Management.Automation.ErrorRecord -ArgumentList $missing,
    'WeeklyReportMissing', 'ObjectNotFound', 'Weekly-2026-43.pdf'
$problem | Show-Console -NoStack -View Error
C#Program.csView on GitHub
// PowerShell supplies an ErrorRecord; a .NET application supplies its exception to the same error view.
var missing = new FileNotFoundException("The weekly report could not be loaded.",
    "Weekly-2026-43.pdf");
Terminal.Write(new ExceptionView(missing) { ShowStack = false });
Full program
using ConsoleMonster;
using ConsoleMonster.Widgets;

// PowerShell supplies an ErrorRecord; a .NET application supplies its exception to the same error view.
var missing = new FileNotFoundException("The weekly report could not be loaded.",
    "Weekly-2026-43.pdf");
Terminal.Write(new ExceptionView(missing) { ShowStack = false });

The recording ran the PowerShell script. This C# program does the same with the library and compiles as shown; its timings are its own.

C# fluentProgram.cs
// PowerShell supplies an ErrorRecord; a .NET application supplies its exception to the same error view.
var missing = new FileNotFoundException("The weekly report could not be loaded.",
    "Weekly-2026-43.pdf");
new ExceptionView(missing).ShowStack(false).Show();
Full program
using ConsoleMonster;
using ConsoleMonster.Widgets;

// PowerShell supplies an ErrorRecord; a .NET application supplies its exception to the same error view.
var missing = new FileNotFoundException("The weekly report could not be loaded.",
    "Weekly-2026-43.pdf");
new ExceptionView(missing).ShowStack(false).Show();

The recording ran the PowerShell script. This C# program does the same with the library and compiles as shown; its timings are its own.

Use it in your session

PowerShell 5.1 and 7
Install-Module ConsoleMonster -Scope CurrentUser
Enable-ConsoleFormatting

See also: Show-Console -View Error

With the default Errors feature, errors that reach the console use the same view as Show-Console -View Error: the exception type, the message, the category, the lines of the script around the failing statement, and the call stack with framework frames folded. It follows $ErrorView: DetailedView adds the stack, and CategoryView keeps PowerShell's own view.

Write-Progress, drawn below the cursor

An unchanged Write-Progress loop with a nested activity. Output written in between scrolls above the progress area.

Write-Progress, drawn by ConsoleMonster 96×1224-bitFull
PowerShellprogress.ps1View on GitHub
# An ordinary Write-Progress loop, drawn by ConsoleMonster in a portable progress scope.
Enable-ConsoleFormatting -Include Progress
Use-ConsoleProgress {
    $sites = 'Warsaw', 'Dublin', 'Berlin'
    for ($i = 0; $i -lt $sites.Count; $i++) {
        $progressParameters = @{
            Id = 1
            Activity = 'Collecting inventory'
            Status = $sites[$i]
            PercentComplete = ($i * 100 / $sites.Count)
        }
        Write-Progress @progressParameters
        foreach ($server in 1..12) {
            $progressParameters = @{
                Id = 2
                ParentId = 1
                Activity = "Servers in $($sites[$i])"
                Status = "SRV$server"
                PercentComplete = ($server * 100 / 12)
            }
            Write-Progress @progressParameters
            # Redirected output has no live progress area; keep the ordinary pause there.
            if ($null -ne $ConsoleSession) {
                Wait-ConsoleDashboard -Seconds 0.11
            } else {
                Start-Sleep -Milliseconds 110
            }
        }
        Write-Host "$($sites[$i]) done: 12 servers"
    }
    Write-Progress -Id 2 -Activity 'Servers' -Completed
    Write-Progress -Id 1 -Activity 'Collecting inventory' -Completed
} -PrintFinalState
Disable-ConsoleFormatting
Write-ConsoleText 'Inventory collected: 36 servers across 3 sites.'
Full program
Import-Module ConsoleMonster

# An ordinary Write-Progress loop, drawn by ConsoleMonster in a portable progress scope.
Enable-ConsoleFormatting -Include Progress
Use-ConsoleProgress {
    $sites = 'Warsaw', 'Dublin', 'Berlin'
    for ($i = 0; $i -lt $sites.Count; $i++) {
        $progressParameters = @{
            Id = 1
            Activity = 'Collecting inventory'
            Status = $sites[$i]
            PercentComplete = ($i * 100 / $sites.Count)
        }
        Write-Progress @progressParameters
        foreach ($server in 1..12) {
            $progressParameters = @{
                Id = 2
                ParentId = 1
                Activity = "Servers in $($sites[$i])"
                Status = "SRV$server"
                PercentComplete = ($server * 100 / 12)
            }
            Write-Progress @progressParameters
            # Redirected output has no live progress area; keep the ordinary pause there.
            if ($null -ne $ConsoleSession) {
                Wait-ConsoleDashboard -Seconds 0.11
            } else {
                Start-Sleep -Milliseconds 110
            }
        }
        Write-Host "$($sites[$i]) done: 12 servers"
    }
    Write-Progress -Id 2 -Activity 'Servers' -Completed
    Write-Progress -Id 1 -Activity 'Collecting inventory' -Completed
} -PrintFinalState
Disable-ConsoleFormatting
Write-ConsoleText 'Inventory collected: 36 servers across 3 sites.'
C#progress.host.csView on GitHub
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "ProgressExample") ]
public sealed class ProgressExample : PSCmdlet {
    protected override void ProcessRecord() {
        ConsoleHostFormatting.Enable(
            this,
            new ConsoleFormattingOptions {
                Include = new[] { ConsoleFormattingFeature.Progress },
                Exclude = new[]
                {
                    ConsoleFormattingFeature.Output,
                    ConsoleFormattingFeature.FormatCommands,
                    ConsoleFormattingFeature.Errors,
                    ConsoleFormattingFeature.Streams,
                    ConsoleFormattingFeature.ReadLine
                }
            });
        try { InvokeCommand.InvokeScript(@"Use-ConsoleProgress {
        $sites = 'Warsaw', 'Dublin', 'Berlin'
        for ($i = 0; $i -lt $sites.Count; $i++) {
            Write-Progress -Id 1 -Activity 'Collecting inventory' -Status $sites[$i] -PercentComplete ($i * 100 / $sites.Count)
            foreach ($server in 1..12) {
                Write-Progress -Id 2 -ParentId 1 -Activity ""Servers in $($sites[$i])"" -Status ""SRV$server"" -PercentComplete ($server * 100 / 12)
                Wait-ConsoleDashboard -Seconds 0.11
            }
            Write-Host ""$($sites[$i]) done: 12 servers""
        }
        Write-Progress -Id 2 -Activity 'Servers' -Completed
        Write-Progress -Id 1 -Activity 'Collecting inventory' -Completed
        } -PrintFinalState
        Write-ConsoleText 'Inventory collected: 36 servers across 3 sites.'"); }
        finally { ConsoleHostFormatting.Disable(
            this,
            new[] { ConsoleFormattingFeature.Progress }); }
    }
}
Full program
using System.Management.Automation;
using ConsoleMonster.PowerShell;

// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "ProgressExample") ]
public sealed class ProgressExample : PSCmdlet {
    protected override void ProcessRecord() {
        ConsoleHostFormatting.Enable(
            this,
            new ConsoleFormattingOptions {
                Include = new[] { ConsoleFormattingFeature.Progress },
                Exclude = new[]
                {
                    ConsoleFormattingFeature.Output,
                    ConsoleFormattingFeature.FormatCommands,
                    ConsoleFormattingFeature.Errors,
                    ConsoleFormattingFeature.Streams,
                    ConsoleFormattingFeature.ReadLine
                }
            });
        try { InvokeCommand.InvokeScript(@"Use-ConsoleProgress {
        $sites = 'Warsaw', 'Dublin', 'Berlin'
        for ($i = 0; $i -lt $sites.Count; $i++) {
            Write-Progress -Id 1 -Activity 'Collecting inventory' -Status $sites[$i] -PercentComplete ($i * 100 / $sites.Count)
            foreach ($server in 1..12) {
                Write-Progress -Id 2 -ParentId 1 -Activity ""Servers in $($sites[$i])"" -Status ""SRV$server"" -PercentComplete ($server * 100 / 12)
                Wait-ConsoleDashboard -Seconds 0.11
            }
            Write-Host ""$($sites[$i]) done: 12 servers""
        }
        Write-Progress -Id 2 -Activity 'Servers' -Completed
        Write-Progress -Id 1 -Activity 'Collecting inventory' -Completed
        } -PrintFinalState
        Write-ConsoleText 'Inventory collected: 36 servers across 3 sites.'"); }
        finally { ConsoleHostFormatting.Disable(
            this,
            new[] { ConsoleFormattingFeature.Progress }); }
    }
}

Download HostExample.csproj beside the source file.

PowerShell 7
Import-Module ConsoleMonster
$moduleBinary = Split-Path (Get-Command Show-Console).DLL
dotnet build ./HostExample.csproj -c Release "-p:ConsoleMonsterModuleDirectory=$moduleBinary"
Import-Module ./bin/Release/net8.0/HostExample.dll
Invoke-ProgressExample

This is a compiled PowerShell cmdlet class. Reference the installed module’s ConsoleMonster and ConsoleMonster.PowerShell assemblies in a PowerShell module project; ProcessRecord runs on the owning pipeline thread. Download the project beside the source file and build/run it from PowerShell 7.

C# fluentprogress.host.cs
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "ProgressExample")]
public sealed class ProgressExample : PSCmdlet
{
    protected override void ProcessRecord()
    {
        ConsoleHostFormatting.Enable(
            this,
            new ConsoleFormattingOptions()
                .Include(new[] { ConsoleFormattingFeature.Progress })
                .Exclude(new[]
                {
                    ConsoleFormattingFeature.Output,
                    ConsoleFormattingFeature.FormatCommands,
                    ConsoleFormattingFeature.Errors,
                    ConsoleFormattingFeature.Streams,
                    ConsoleFormattingFeature.ReadLine
                }));
        try
        {
            InvokeCommand.InvokeScript(@"Use-ConsoleProgress {
        $sites = 'Warsaw', 'Dublin', 'Berlin'
        for ($i = 0; $i -lt $sites.Count; $i++) {
            Write-Progress -Id 1 -Activity 'Collecting inventory' -Status $sites[$i] -PercentComplete ($i * 100 / $sites.Count)
            foreach ($server in 1..12) {
                Write-Progress -Id 2 -ParentId 1 -Activity ""Servers in $($sites[$i])"" -Status ""SRV$server"" -PercentComplete ($server * 100 / 12)
                Wait-ConsoleDashboard -Seconds 0.11
            }
            Write-Host ""$($sites[$i]) done: 12 servers""
        }
        Write-Progress -Id 2 -Activity 'Servers' -Completed
        Write-Progress -Id 1 -Activity 'Collecting inventory' -Completed
        } -PrintFinalState
        Write-ConsoleText 'Inventory collected: 36 servers across 3 sites.'");
        }
        finally
        {
            ConsoleHostFormatting.Disable(this, new[] { ConsoleFormattingFeature.Progress });
        }
    }
}
Full program
using System.Management.Automation;
using ConsoleMonster.PowerShell;

// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "ProgressExample")]
public sealed class ProgressExample : PSCmdlet
{
    protected override void ProcessRecord()
    {
        ConsoleHostFormatting.Enable(
            this,
            new ConsoleFormattingOptions()
                .Include(new[] { ConsoleFormattingFeature.Progress })
                .Exclude(new[]
                {
                    ConsoleFormattingFeature.Output,
                    ConsoleFormattingFeature.FormatCommands,
                    ConsoleFormattingFeature.Errors,
                    ConsoleFormattingFeature.Streams,
                    ConsoleFormattingFeature.ReadLine
                }));
        try
        {
            InvokeCommand.InvokeScript(@"Use-ConsoleProgress {
        $sites = 'Warsaw', 'Dublin', 'Berlin'
        for ($i = 0; $i -lt $sites.Count; $i++) {
            Write-Progress -Id 1 -Activity 'Collecting inventory' -Status $sites[$i] -PercentComplete ($i * 100 / $sites.Count)
            foreach ($server in 1..12) {
                Write-Progress -Id 2 -ParentId 1 -Activity ""Servers in $($sites[$i])"" -Status ""SRV$server"" -PercentComplete ($server * 100 / 12)
                Wait-ConsoleDashboard -Seconds 0.11
            }
            Write-Host ""$($sites[$i]) done: 12 servers""
        }
        Write-Progress -Id 2 -Activity 'Servers' -Completed
        Write-Progress -Id 1 -Activity 'Collecting inventory' -Completed
        } -PrintFinalState
        Write-ConsoleText 'Inventory collected: 36 servers across 3 sites.'");
        }
        finally
        {
            ConsoleHostFormatting.Disable(this, new[] { ConsoleFormattingFeature.Progress });
        }
    }
}

Download HostExample.csproj beside the source file.

PowerShell 7
Import-Module ConsoleMonster
$moduleBinary = Split-Path (Get-Command Show-Console).DLL
dotnet build ./HostExample.csproj -c Release "-p:ConsoleMonsterModuleDirectory=$moduleBinary"
Import-Module ./bin/Release/net8.0/HostExample.dll
Invoke-ProgressExample

This is a compiled PowerShell cmdlet class. Reference the installed module’s ConsoleMonster and ConsoleMonster.PowerShell assemblies in a PowerShell module project; ProcessRecord runs on the owning pipeline thread. Download the project beside the source file and build/run it from PowerShell 7.

Use it in your session

PowerShell 5.1 and 7
Install-Module ConsoleMonster -Scope CurrentUser
Enable-ConsoleFormatting -Include Progress

See also: Use-ConsoleProgress

By default Write-Progress stays PowerShell's own bar, coloured by the theme through Streams. With -Include Progress, Write-Progress draws ConsoleMonster's progress area for the rest of the session, so existing loops get one row per activity below the cursor, nested with -ParentId, with a bar, the percentage, the status and the elapsed time. Output written in between appears above the area, and the area disappears when every activity completes. $ProgressPreference is honoured. Progress written by compiled cmdlets such as Copy-Item is still drawn by PowerShell.

Warning, verbose and debug colours

With the default Streams feature, PowerShell's own warning, verbose and debug messages (and errors on PowerShell 7.2 and later) take the active theme's colours, so they match the rest of the output and stay readable on a light background. Choose the theme first, or enable Streams again after Set-ConsoleTheme.

Windows PowerShell 5.1
PowerShell 7.6
PowerShellstreams.ps1
# Show every stream for this demo.
$VerbosePreference = 'Continue'
$DebugPreference = 'Continue'

New-ConsoleRule -Title "PowerShell's own colours" | Show-Console
Write-Warning 'Certificate for mail.evotec.xyz expires in 12 days'
Write-Verbose 'Queried 4 domain controllers in 2 domains'
Write-Debug 'Cache hit for evotec.xyz'

Enable-ConsoleFormatting -Include Streams

New-ConsoleRule -Title 'With -Include Streams: the theme''s colours' | Show-Console
Write-Warning 'Certificate for mail.evotec.xyz expires in 12 days'
Write-Verbose 'Queried 4 domain controllers in 2 domains'
Write-Debug 'Cache hit for evotec.xyz'

Disable-ConsoleFormatting -Feature Streams
Full program
Import-Module ConsoleMonster

# Show every stream for this demo.
$VerbosePreference = 'Continue'
$DebugPreference = 'Continue'

New-ConsoleRule -Title "PowerShell's own colours" | Show-Console
Write-Warning 'Certificate for mail.evotec.xyz expires in 12 days'
Write-Verbose 'Queried 4 domain controllers in 2 domains'
Write-Debug 'Cache hit for evotec.xyz'

Enable-ConsoleFormatting -Include Streams

New-ConsoleRule -Title 'With -Include Streams: the theme''s colours' | Show-Console
Write-Warning 'Certificate for mail.evotec.xyz expires in 12 days'
Write-Verbose 'Queried 4 domain controllers in 2 domains'
Write-Debug 'Cache hit for evotec.xyz'

Disable-ConsoleFormatting -Feature Streams
The same script on Windows PowerShell 5.1 and PowerShell 7; switch the site's theme to see the light-theme run.

Only the colours change. Write-Warning, Write-Verbose and Write-Debug stay PowerShell's commands, with their WARNING:, VERBOSE: and DEBUG: prefixes, preferences, redirection and transcripts. PowerShell 7.2 and later set $PSStyle.Formatting; Windows PowerShell 5.1 and PowerShell 7.0 and 7.1 set the host's $Host.PrivateData colours, and hosts without them (remoting, headless) are left alone. Disable-ConsoleFormatting -Feature Streams puts back exactly the values it changed. For rich messages in your own scripts, with status symbols and markup, use Show-ConsoleStatusLine or Write-ConsoleLogEntry.

Minimal shell prompt

Add Prompt to the default output formatting:

Import-Module ConsoleMonster
Set-ConsoleTheme -Theme Dark  # use Light for a light terminal background
Enable-ConsoleFormatting -Include Prompt
Enable-ConsoleFormatting -Include Prompt -ProfileSnippet  # prints profile lines

The prompt shows the shortened path, git branch with * for index or working-tree changes, and a success or failure mark. A completed command taking more than two seconds also shows its duration, using PowerShell's own history timestamps. An old nonzero native exit code does not mark a later successful PowerShell command as failed. PSReadLine handlers and key bindings stay as they are.

Git is optional and the prompt never waits for it: the first prompt can omit the branch, and a change can take up to five seconds to appear. Missing git, an unavailable repository or an expired probe omits that segment. Submodule contents are not scanned.

An existing oh-my-posh or Starship prompt is kept. Use Enable-ConsoleFormatting -Include Prompt -Force to replace it explicitly. Other custom prompts are backed up, including their closure scope. Disable-ConsoleFormatting -Feature Prompt, disabling all enabled features without a feature argument, or Remove-Module ConsoleMonster restores the original. A prompt you install later is kept.

Only the top-level local console prompt is themed. Assigned, piped, redirected, transcribed, recorded, job, remote and nested prompt calls use the original prompt. Native output, error records, preferences, $? and $LASTEXITCODE retain their behavior. Engines whose status or transcription state cannot be checked keep native output.

In C#

This complete C# program calls the renderer the PowerShell prompt uses, with a fixed illustrative path, branch and finished commands; the PowerShell feature collects the live session's data instead.

Terminal
dotnet new console -n PromptExample
cd PromptExample
dotnet add package ConsoleMonster
C#Program.cs
// Illustrative completed-command data; the PowerShell feature supplies these values from the session.
Terminal.Write(new ShellPrompt
{
    Path = "~/src/Operations/Deployment/Scripts",
    Home = "~",
    Branch = "feature/themed-prompt",
    Dirty = true,
    Succeeded = true
});
Terminal.Write(new ShellPrompt
{
    Path = "~/src/Operations/Deployment/Scripts",
    Home = "~",
    Branch = "feature/themed-prompt",
    Dirty = true,
    Succeeded = false,
    Duration = TimeSpan.FromSeconds(3.4)
});
Full program
using ConsoleMonster;
using ConsoleMonster.Widgets;

// Illustrative completed-command data; the PowerShell feature supplies these values from the session.
Terminal.Write(new ShellPrompt
{
    Path = "~/src/Operations/Deployment/Scripts",
    Home = "~",
    Branch = "feature/themed-prompt",
    Dirty = true,
    Succeeded = true
});
Terminal.Write(new ShellPrompt
{
    Path = "~/src/Operations/Deployment/Scripts",
    Home = "~",
    Branch = "feature/themed-prompt",
    Dirty = true,
    Succeeded = false,
    Duration = TimeSpan.FromSeconds(3.4)
});

Run: dotnet run

Terminal
dotnet new console -n PromptExample
cd PromptExample
dotnet add package ConsoleMonster
C# fluentProgram.cs
// Illustrative completed-command data; the PowerShell feature supplies these values from the session.
Ui.ShellPrompt()
    .Path("~/src/Operations/Deployment/Scripts")
    .Home("~")
    .Branch("feature/themed-prompt")
    .Dirty()
    .Succeeded()
    .Show();
Ui.ShellPrompt()
    .Path("~/src/Operations/Deployment/Scripts")
    .Home("~")
    .Branch("feature/themed-prompt")
    .Dirty()
    .Succeeded(false)
    .Duration(TimeSpan.FromSeconds(3.4))
    .Show();
Full program
using ConsoleMonster;
using ConsoleMonster.Widgets;

// Illustrative completed-command data; the PowerShell feature supplies these values from the session.
Ui.ShellPrompt()
    .Path("~/src/Operations/Deployment/Scripts")
    .Home("~")
    .Branch("feature/themed-prompt")
    .Dirty()
    .Succeeded()
    .Show();
Ui.ShellPrompt()
    .Path("~/src/Operations/Deployment/Scripts")
    .Home("~")
    .Branch("feature/themed-prompt")
    .Dirty()
    .Succeeded(false)
    .Duration(TimeSpan.FromSeconds(3.4))
    .Show();

Run: dotnet run

Shell prompt · 120 columns
Shell prompt · 60 columns

Success first, then a failed 3.4-second command, at 120 and 60 columns. Switch the site theme to compare light and dark.

Command-line help for .NET hosts

In PowerShell, use the native command surface first:

Show-ConsoleHelp Get-ChildItem

A .NET command-line host can project its parser metadata into HelpTopic.CommandLine and render it with HelpView. ConsoleMonster owns presentation; the host keeps argument parsing, command selection and execution. No parser package is required by ConsoleMonster.

HelpCommand describes commands and optional groups. HelpValue describes literal value IDs, descriptions and optional muted notes. HelpSyntaxParameter.Named = false and HelpParameter.Named = false describe positional arguments. The renderer adds one dash to a parameter name: use Name = "-output" for --output. Aliases such as -o are literal. Labels follow the render profile's language; set ValuesHeading only for a custom heading.

dotnet run 120×2124-bitFull
dotnet run 60×2224-bitFull
C#Program.cs
HelpTopic topic = new HelpTopic("atlas") {
    Synopsis = "Inspect saved inventory and write reports.",
    CommandLine = new CommandLineHelp { Usage = "atlas [command] [options]" }
};
topic.CommandLine.Commands.Add(new HelpCommand("inspect", "Inspect the saved inventory.",
    "Inventory"));
topic.CommandLine.Commands.Add(new HelpCommand("export", "Write a report from saved observations.",
    "Reports"));
topic.CommandLine.Values.Add(new HelpValue("inventory", "Host and service observations.",
    "Saved data") {
    Note = "offline"
});
HelpParameter output = new HelpParameter("-output") {
    Type = "path", Description = "Destination for the generated report.", Default = "report.html"
};
output.Aliases.Add("-o");
topic.Parameters.Add(output);
topic.Examples.Add(new HelpExample(null, "atlas export --output report.html"));
Terminal.Write(new HelpView(topic));
Full program
using ConsoleMonster;
using ConsoleMonster.Help;
using ConsoleMonster.Widgets;

HelpTopic topic = new HelpTopic("atlas") {
    Synopsis = "Inspect saved inventory and write reports.",
    CommandLine = new CommandLineHelp { Usage = "atlas [command] [options]" }
};
topic.CommandLine.Commands.Add(new HelpCommand("inspect", "Inspect the saved inventory.",
    "Inventory"));
topic.CommandLine.Commands.Add(new HelpCommand("export", "Write a report from saved observations.",
    "Reports"));
topic.CommandLine.Values.Add(new HelpValue("inventory", "Host and service observations.",
    "Saved data") {
    Note = "offline"
});
HelpParameter output = new HelpParameter("-output") {
    Type = "path", Description = "Destination for the generated report.", Default = "report.html"
};
output.Aliases.Add("-o");
topic.Parameters.Add(output);
topic.Examples.Add(new HelpExample(null, "atlas export --output report.html"));
Terminal.Write(new HelpView(topic));
C# fluentProgram.cs
HelpTopic topic = new HelpTopic("atlas")
    .Synopsis("Inspect saved inventory and write reports.")
    .CommandLine(new CommandLineHelp().Usage("atlas [command] [options]"));
topic.CommandLine!.Commands.Add(new HelpCommand("inspect", "Inspect the saved inventory.",
    "Inventory"));
topic.CommandLine!.Commands.Add(new HelpCommand("export", "Write a report from saved observations.",
    "Reports"));
topic.CommandLine!.Values.Add(new HelpValue("inventory", "Host and service observations.",
    "Saved data")
    .Note("offline"));
HelpParameter output = new HelpParameter("-output")
    .Type("path")
    .Description("Destination for the generated report.")
    .Default("report.html");
output.Aliases.Add("-o");
topic.Parameters.Add(output);
topic.Examples.Add(new HelpExample(null, "atlas export --output report.html"));
new HelpView(topic).Show();
Full program
using ConsoleMonster;
using ConsoleMonster.Help;
using ConsoleMonster.Widgets;

HelpTopic topic = new HelpTopic("atlas")
    .Synopsis("Inspect saved inventory and write reports.")
    .CommandLine(new CommandLineHelp().Usage("atlas [command] [options]"));
topic.CommandLine!.Commands.Add(new HelpCommand("inspect", "Inspect the saved inventory.",
    "Inventory"));
topic.CommandLine!.Commands.Add(new HelpCommand("export", "Write a report from saved observations.",
    "Reports"));
topic.CommandLine!.Values.Add(new HelpValue("inventory", "Host and service observations.",
    "Saved data")
    .Note("offline"));
HelpParameter output = new HelpParameter("-output")
    .Type("path")
    .Description("Destination for the generated report.")
    .Default("report.html");
output.Aliases.Add("-o");
topic.Parameters.Add(output);
topic.Examples.Add(new HelpExample(null, "atlas export --output report.html"));
new HelpView(topic).Show();
The complete .NET example compiles against ConsoleMonster and renders at 120 and 60 columns in both themes.

Next

Edit this page on GitHub