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.
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 promptTo keep it on in every session, add the lines
-ProfileSnippetprints 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 $PROFILEOpen a new session.
Disable-ConsoleFormattingturns it off again for a session; remove the lines from$PROFILEto 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.
PS> Import-Module ConsoleMonster PS> Show-ConsoleHelp Test-MailDomain Test-MailDomain Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS. Syntax Test-MailDomain [-Domain] <String> [[-Selector] <String[]>] [[-Timeout] <TimeSpan>] [<CommonParameters>] Description Resolves each record, compares it with the recommended settings and returns one result per check. Parameters ╭───────────┬──────────┬──────────┬──────────┬──────────┬────────────────────┬──────────────────╮ │ Parameter │ Type │ Required │ Position │ Pipeline │ Default │ Description │ ├───────────┼──────────┼──────────┼──────────┼──────────┼────────────────────┼──────────────────┤ │ -Domain │ String │ yes │ 1 │ ByValue │ │ The domain to │ │ │ │ │ │ │ │ check, for │ │ │ │ │ │ │ │ example │ │ │ │ │ │ │ │ evotec.xyz. │ │ -Selector │ String[] │ no │ 2 │ no │ @('selector1') │ The DKIM │ │ │ │ │ │ │ │ selectors to │ │ │ │ │ │ │ │ look up. │ │ -Timeout │ TimeSpan │ no │ 3 │ no │ (New-TimeSpan │ How long to wait │ │ │ │ │ │ │ -Seconds 5) │ for each DNS │ │ │ │ │ │ │ │ answer. │ ╰───────────┴──────────┴──────────┴──────────┴──────────┴────────────────────┴──────────────────╯ Common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -OutVariable, -Verbose, -WarningAction and the others (about_CommonParameters). Examples Example 1 Test-MailDomain -Domain evotec.xyz Example 2 'evotec.xyz', 'evotec.pl' | Test-MailDomain -Selector selector1, selector2 | Show-ConsoleTable
Install-Module ConsoleMonster -Scope CurrentUser# 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-MailDomainFull 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-MailDomainRun: pwsh ./help.ps1
// 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.
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-HelpExampleThis 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.
// 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.
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-HelpExampleThis 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.
See also: Show-ConsoleHelp
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.
Test-MailDomain 1–2 / 2 ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Test-MailDomain -WhatIf │ │ Checks the mail records of a domain: MX, SPF, DMARC, DKIM and MTA-STS. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ Overview Parameters Examples Related ────────────────────────────────━━━━━━━━━─────────────────────────────────────────────────────────── Show-ConsoleTable https://consolemonster.dev/ ↑↓ move enter open/fold esc/q close tab switch pane 1-4 open tab [/] links / search ? keys
Install-Module ConsoleMonster -Scope CurrentUser# 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-MailDomainFull 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-MailDomainRun: pwsh ./help-viewer.ps1
See also: Show-ConsoleHelp
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.
NAME
Get-ConsoleCapability
SYNOPSIS
Shows what ConsoleMonster detected about the current terminal.
SYNTAX
Get-ConsoleCapability [-Refresh <SwitchParameter>] [<CommonParameters>]
DESCRIPTION
Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support,
console font and the reasons behind each decision. -Refresh detects again (after a resize or font change).
RELATED LINKS
https://consolemonster.dev/powershell/commands/get-consolecapability/
REMARKS
To see the examples, type: "Get-Help Get-ConsoleCapability -Examples"
For more information, type: "Get-Help Get-ConsoleCapability -Detailed"
For technical information, type: "Get-Help Get-ConsoleCapability -Full"
For online help, type: "Get-Help Get-ConsoleCapability -Online"
NAME
Get-ConsoleCapability
SYNOPSIS
Shows what ConsoleMonster detected about the current terminal.
SYNTAX
Get-ConsoleCapability [-Refresh <SwitchParameter>] [<CommonParameters>]
DESCRIPTION
Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support,
console font and the reasons behind each decision. -Refresh detects again (after a resize or font change).
RELATED LINKS
https://consolemonster.dev/powershell/commands/get-consolecapability/
REMARKS
To see the examples, type: "Get-Help Get-ConsoleCapability -Examples"
For more information, type: "Get-Help Get-ConsoleCapability -Detailed"
For technical information, type: "Get-Help Get-ConsoleCapability -Full"
For online help, type: "Get-Help Get-ConsoleCapability -Online"Get-ConsoleCapability Shows what ConsoleMonster detected about the current terminal. Syntax Get-ConsoleCapability [-Refresh] [<CommonParameters>] Description Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support, console font and the reasons behind each decision. -Refresh detects again (after a resize or font change). Related links https://consolemonster.dev/powershell/commands/get-consolecapability/ Remarks Get-Help Get-ConsoleCapability -Examples / -Detailed / -Full
Get-ConsoleCapability Shows what ConsoleMonster detected about the current terminal. Syntax Get-ConsoleCapability [-Refresh] [<CommonParameters>] Description Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support, console font and the reasons behind each decision. -Refresh detects again (after a resize or font change). Related links https://consolemonster.dev/powershell/commands/get-consolecapability/ Remarks Get-Help Get-ConsoleCapability -Examples / -Detailed / -Full
Get-ConsoleCapability Shows what ConsoleMonster detected about the current terminal. Syntax Get-ConsoleCapability [-Refresh] [<CommonParameters>] Description Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support, console font and the reasons behind each decision. -Refresh detects again (after a resize or font change). Related links https://consolemonster.dev/powershell/commands/ get-consolecapability/ Remarks Get-Help Get-ConsoleCapability -Examples / -Detailed / -Full
Get-ConsoleCapability Shows what ConsoleMonster detected about the current terminal. Syntax Get-ConsoleCapability [-Refresh] [<CommonParameters>] Description Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support, console font and the reasons behind each decision. -Refresh detects again (after a resize or font change). Related links https://consolemonster.dev/powershell/commands/ get-consolecapability/ Remarks Get-Help Get-ConsoleCapability -Examples / -Detailed / -Full
Import-Module ConsoleMonster
Get-Help Get-ConsoleCapabilityFull program
Import-Module ConsoleMonster
Get-Help Get-ConsoleCapabilityImport-Module ConsoleMonster
Enable-ConsoleFormatting -Include Help
Get-Help Get-ConsoleCapabilityFull program
Import-Module ConsoleMonster
Enable-ConsoleFormatting -Include Help
Get-Help Get-ConsoleCapabilityGet-ConsoleCapability 1–9 / 10 ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Get-ConsoleCapability ConsoleMonster v3.2.0 │ │ Shows what ConsoleMonster detected about the current terminal. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ Overview Parameters Examples Related ━━━━━━━━━━────────────────────────────────────────────────────────────────────────────────────────────────────────────── ▌ Syntax │Overview › Syntax Description │› ▾ Syntax Outputs │ Get-ConsoleCapability [-Refresh] [<CommonParameters>] │ │ ▾ Description │ Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour │ depth, glyph tier, size, VT support, console font and the reasons behind each │ decision. -Refresh detects again (after a resize or font change). │ │ ▾ Outputs ↑↓ move enter open/fold esc/q close tab switch pane 1-4 open tab / search ctrl+k go to pgup/pgdn page ? keys
Get-ConsoleCapability 1–9 / 10 ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Get-ConsoleCapability ConsoleMonster v3.2.0 │ │ Shows what ConsoleMonster detected about the current terminal. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ Overview Parameters Examples Related ━━━━━━━━━━────────────────────────────────────────────────────────────────────────────────────────────────────────────── ▌ Syntax │Overview › Syntax Description │› ▾ Syntax Outputs │ Get-ConsoleCapability [-Refresh] [<CommonParameters>] │ │ ▾ Description │ Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour │ depth, glyph tier, size, VT support, console font and the reasons behind each │ decision. -Refresh detects again (after a resize or font change). │ │ ▾ Outputs ↑↓ move enter open/fold esc/q close tab switch pane 1-4 open tab / search ctrl+k go to pgup/pgdn page ? keys
Get-ConsoleCapability 1–8 / 12 ╭──────────────────────────────────────────────────────────╮ │ Get-ConsoleCapability ConsoleMonster v3.2.0 │ │ Shows what ConsoleMonster detected about the current │ │ terminal. │ ╰──────────────────────────────────────────────────────────╯ Overview Parameters Examples Related ━━━━━━━━━━────────────────────────────────────────────────── Overview › Syntax › ▾ Syntax Get-ConsoleCapability [-Refresh] [<CommonParameters>] ▾ Description Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support, console font and the reasons behind each decision. -Refresh detects again (after a resize or font ↑↓ move enter open/fold esc/q close ? keys
Get-ConsoleCapability 1–8 / 12 ╭──────────────────────────────────────────────────────────╮ │ Get-ConsoleCapability ConsoleMonster v3.2.0 │ │ Shows what ConsoleMonster detected about the current │ │ terminal. │ ╰──────────────────────────────────────────────────────────╯ Overview Parameters Examples Related ━━━━━━━━━━────────────────────────────────────────────────── Overview › Syntax › ▾ Syntax Get-ConsoleCapability [-Refresh] [<CommonParameters>] ▾ Description Returns the terminal profile: kind, mode (Interactive, Stream, Plain), colour depth, glyph tier, size, VT support, console font and the reasons behind each decision. -Refresh detects again (after a resize or font ↑↓ move enter open/fold esc/q close ? keys
Import-Module ConsoleMonster
Enable-ConsoleFormatting -Include Help
help Get-ConsoleCapability -FullFull program
Import-Module ConsoleMonster
Enable-ConsoleFormatting -Include Help
help Get-ConsoleCapability -FullCompact 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.
Get-Item: Cannot load the inventory: the source file is missing. deploy.ps1:12:1 Get-Item -LiteralPath './inventory.json' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ObjectNotFound · ./inventory.json cause: The source was removed. +2 inner exceptions · Get-Error for details
Get-Item: Cannot load the inventory: the source file is missing. deploy.ps1:12:1 Get-Item -LiteralPath './inventory.json' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ObjectNotFound · ./inventory.json cause: The source was removed. +2 inner exceptions · Get-Error for details
Get-Item: Cannot load the inventory: the source file is missing. deploy.ps1:12:1 Get-Item -LiteralPath './inventory.json' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ObjectNotFound · ./inventory.json cause: The source was removed. +2 inner exceptions · Get-Error for details
Get-Item: Cannot load the inventory: the source file is missing. deploy.ps1:12:1 Get-Item -LiteralPath './inventory.json' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ObjectNotFound · ./inventory.json cause: The source was removed. +2 inner exceptions · Get-Error for details
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 ErrorsFull 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 ErrorsExceptionInfo 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"
});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();
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.
✗ FileNotFoundException The weekly report could not be loaded. ObjectNotFound (Weekly-2026-43.pdf) · WeeklyReportMissing
# 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 ErrorFull 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// 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.
// 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
Install-Module ConsoleMonster -Scope CurrentUser
Enable-ConsoleFormattingSee 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.
Dublin done: 12 servers Berlin done: 12 servers Inventory collected: 36 servers across 3 sites.
# 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.'// 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.
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-ProgressExampleThis 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.
// 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.
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-ProgressExampleThis 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
Install-Module ConsoleMonster -Scope CurrentUser
Enable-ConsoleFormatting -Include ProgressSee 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.
── PowerShell's own colours ──────────────────────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz ── With -Include Streams: the theme's colours ────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz
── PowerShell's own colours ──────────────────────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz ── With -Include Streams: the theme's colours ────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz
── PowerShell's own colours ──────────────────────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz ── With -Include Streams: the theme's colours ────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz
── PowerShell's own colours ──────────────────────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz ── With -Include Streams: the theme's colours ────────────────────────────────────────────────────── WARNING: Certificate for mail.evotec.xyz expires in 12 days VERBOSE: Queried 4 domain controllers in 2 domains DEBUG: Cache hit for evotec.xyz
# 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 StreamsFull 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 StreamsOnly 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.
dotnet new console -n PromptExample
cd PromptExample
dotnet add package ConsoleMonster// 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
dotnet new console -n PromptExample
cd PromptExample
dotnet add package ConsoleMonster// 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
~/src/Operations/Deployment/Scripts (feature/themed-prompt*) ✓ > ~/src/Operations/Deployment/Scripts (feature/themed-prompt*) 3.4s ✗ >
~/src/Operations/Deployment/Scripts (feature/themed-prompt*) ✓ > ~/src/Operations/Deployment/Scripts (feature/themed-prompt*) 3.4s ✗ >
~/src/…/Deployment/Scripts (feature/themed-prompt*) ✓ > ~/src/…/Scripts (feature/themed-prompt*) 3.4s ✗ >
~/src/…/Deployment/Scripts (feature/themed-prompt*) ✓ > ~/src/…/Scripts (feature/themed-prompt*) 3.4s ✗ >
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.
Inspect saved inventory and write reports. Usage atlas [command] [options] Commands Inventory inspect Inspect the saved inventory. Reports export Write a report from saved observations. Values Saved data inventory Host and service observations. offline Options -o, --output <path> Destination for the generated report. [default: report.html] Examples atlas export --output report.html
Inspect saved inventory and write reports. Usage atlas [command] [options] Commands Inventory inspect Inspect the saved inventory. Reports export Write a report from saved observations. Values Saved data inventory Host and service observations. offline Options -o, --output <path> Destination for the generated report. [default: report.html] Examples atlas export --output report.html
Inspect saved inventory and write reports. Usage atlas [command] [options] Commands Inventory inspect Inspect the saved inventory. Reports export Write a report from saved observations. Values Saved data inventory Host and service observations. offline Options -o, --output <path> Destination for the generated report. [default: report.html] Examples atlas export --output report.html
Inspect saved inventory and write reports. Usage atlas [command] [options] Commands Inventory inspect Inspect the saved inventory. Reports export Write a report from saved observations. Values Saved data inventory Host and service observations. offline Options -o, --output <path> Destination for the generated report. [default: report.html] Examples atlas export --output report.html
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));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();
Next
- Logging: Microsoft.Extensions.Logging, Serilog and NLog with ConsoleMonster's level tags.
- dotnet new template: a console app with a menu, a report, logging and the hosting dashboard.
- Format everyday PowerShell output: turn the formatting on for every session.