The commands you already type can show readable tables, records and a summary line, without changing a single command. One line turns it on for the session:
Enable-ConsoleFormatting
Files, processes, services, events, JSON and CSV records, history, jobs, drives, certificates, environment paths, updates, firewall rules, web responses, file hashes, Select-String matches and Compare-Object results then show as ConsoleMonster views when they reach the console. The objects stay the same: pipelines, variables, Out-String, files, transcripts, jobs and remoting get exactly what PowerShell gives them.
Before and after Enable-ConsoleFormatting
An invented service inventory, a version and a hashtable, first as PowerShell shows them, then with ConsoleMonster turned on for the session.
PS> Enable-ConsoleFormatting PS> PS> # The same objects now PS> $services ╭───────────┬─────────┬───────────────────┬───────────╮ │ Status │ Name │ DisplayName │ StartType │ ├───────────┼─────────┼───────────────────┼───────────┤ │ ● Running │ WebApi │ Web API │ │ │ ● Running │ Worker │ Background worker │ │ │ – Stopped │ Archive │ Archive │ │ ╰───────────┴─────────┴───────────────────┴───────────╯ PS> [version] '2.0.0' 2.0.0 Major 2 Minor 0 Build 0 Revision -1 PS> [ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false } Domain evotec.xyz Records 14 DNSSEC – no PS>
# Invented services: the same inventory before and after formatting is enabled.
$services = @(
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'
ServiceName = 'WebApi'; Status = 'Running'; ServicesDependedOn = @()
DisplayName = 'Web API' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'
ServiceName = 'Worker'; Status = 'Running'; ServicesDependedOn = @()
DisplayName = 'Background worker' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'
ServiceName = 'Archive'; Status = 'Stopped'; ServicesDependedOn = @()
DisplayName = 'Archive' }
)
# PowerShell's own output
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }
Clear-Host
Enable-ConsoleFormatting
# The same objects now
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }Full program
Import-Module ConsoleMonster
# Invented services: the same inventory before and after formatting is enabled.
$services = @(
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'
ServiceName = 'WebApi'; Status = 'Running'; ServicesDependedOn = @()
DisplayName = 'Web API' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'
ServiceName = 'Worker'; Status = 'Running'; ServicesDependedOn = @()
DisplayName = 'Background worker' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'
ServiceName = 'Archive'; Status = 'Stopped'; ServicesDependedOn = @()
DisplayName = 'Archive' }
)
# PowerShell's own output
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }
Clear-Host
Enable-ConsoleFormatting
# The same objects now
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "FormattingExample") ]
public sealed class FormattingExample : PSCmdlet {
protected override void ProcessRecord() {
const string inventory = @"# Invented services: the same inventory before and after formatting is enabled.
$services = @(
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'WebApi'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Web API' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Worker'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Background worker' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Archive'; Status = 'Stopped'; ServicesDependedOn = @(); DisplayName = 'Archive' }
)
";
InvokeCommand.InvokeScript(inventory + @"& {
# PowerShell's own output
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }
} | Microsoft.PowerShell.Core\Out-Default");
InvokeCommand.InvokeScript("Clear-Host");
ConsoleHostFormatting.Enable(
this,
new ConsoleFormattingOptions {
Include = new[] { ConsoleFormattingFeature.Output },
Exclude = new[]
{
ConsoleFormattingFeature.FormatCommands,
ConsoleFormattingFeature.Errors,
ConsoleFormattingFeature.Streams,
ConsoleFormattingFeature.ReadLine
}
});
try {
using var output = new ConsoleDefaultOutput(
this,
new ConsoleDefaultOutputOptions { Force = true });
foreach (var item in InvokeCommand.InvokeScript(inventory + @"# The same objects now
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }")) { output.Write(item); }
output.Complete();
} finally { ConsoleHostFormatting.Disable(
this,
new[] { ConsoleFormattingFeature.Output }); }
}
}Full program
using System.Management.Automation;
using ConsoleMonster.PowerShell;
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "FormattingExample") ]
public sealed class FormattingExample : PSCmdlet {
protected override void ProcessRecord() {
const string inventory = @"# Invented services: the same inventory before and after formatting is enabled.
$services = @(
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'WebApi'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Web API' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Worker'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Background worker' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Archive'; Status = 'Stopped'; ServicesDependedOn = @(); DisplayName = 'Archive' }
)
";
InvokeCommand.InvokeScript(inventory + @"& {
# PowerShell's own output
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }
} | Microsoft.PowerShell.Core\Out-Default");
InvokeCommand.InvokeScript("Clear-Host");
ConsoleHostFormatting.Enable(
this,
new ConsoleFormattingOptions {
Include = new[] { ConsoleFormattingFeature.Output },
Exclude = new[]
{
ConsoleFormattingFeature.FormatCommands,
ConsoleFormattingFeature.Errors,
ConsoleFormattingFeature.Streams,
ConsoleFormattingFeature.ReadLine
}
});
try {
using var output = new ConsoleDefaultOutput(
this,
new ConsoleDefaultOutputOptions { Force = true });
foreach (var item in InvokeCommand.InvokeScript(inventory + @"# The same objects now
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }")) { output.Write(item); }
output.Complete();
} finally { ConsoleHostFormatting.Disable(
this,
new[] { ConsoleFormattingFeature.Output }); }
}
}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-FormattingExampleThis 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, "FormattingExample")]
public sealed class FormattingExample : PSCmdlet
{
protected override void ProcessRecord()
{
const string inventory = @"# Invented services: the same inventory before and after formatting is enabled.
$services = @(
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'WebApi'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Web API' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Worker'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Background worker' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Archive'; Status = 'Stopped'; ServicesDependedOn = @(); DisplayName = 'Archive' }
)
";
InvokeCommand.InvokeScript(inventory + @"& {
# PowerShell's own output
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }
} | Microsoft.PowerShell.Core\Out-Default");
InvokeCommand.InvokeScript("Clear-Host");
ConsoleHostFormatting.Enable(
this,
new ConsoleFormattingOptions()
.Include(new[] { ConsoleFormattingFeature.Output })
.Exclude(new[]
{
ConsoleFormattingFeature.FormatCommands,
ConsoleFormattingFeature.Errors,
ConsoleFormattingFeature.Streams,
ConsoleFormattingFeature.ReadLine
}));
try
{
using var output = new ConsoleDefaultOutput(
this,
new ConsoleDefaultOutputOptions().Force());
foreach (var item in InvokeCommand.InvokeScript(inventory + @"# The same objects now
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }"))
{
output.Write(item);
}
output.Complete();
}
finally
{
ConsoleHostFormatting.Disable(this, new[] { ConsoleFormattingFeature.Output });
}
}
}
Full program
using System.Management.Automation;
using ConsoleMonster.PowerShell;
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "FormattingExample")]
public sealed class FormattingExample : PSCmdlet
{
protected override void ProcessRecord()
{
const string inventory = @"# Invented services: the same inventory before and after formatting is enabled.
$services = @(
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'WebApi'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Web API' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Worker'; Status = 'Running'; ServicesDependedOn = @(); DisplayName = 'Background worker' }
[pscustomobject] @{ PSTypeName = 'System.ServiceProcess.ServiceController'; ServiceName = 'Archive'; Status = 'Stopped'; ServicesDependedOn = @(); DisplayName = 'Archive' }
)
";
InvokeCommand.InvokeScript(inventory + @"& {
# PowerShell's own output
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }
} | Microsoft.PowerShell.Core\Out-Default");
InvokeCommand.InvokeScript("Clear-Host");
ConsoleHostFormatting.Enable(
this,
new ConsoleFormattingOptions()
.Include(new[] { ConsoleFormattingFeature.Output })
.Exclude(new[]
{
ConsoleFormattingFeature.FormatCommands,
ConsoleFormattingFeature.Errors,
ConsoleFormattingFeature.Streams,
ConsoleFormattingFeature.ReadLine
}));
try
{
using var output = new ConsoleDefaultOutput(
this,
new ConsoleDefaultOutputOptions().Force());
foreach (var item in InvokeCommand.InvokeScript(inventory + @"# The same objects now
$services
[version] '2.0.0'
[ordered] @{ Domain = 'evotec.xyz'; Records = 14; DNSSEC = $false }"))
{
output.Write(item);
}
output.Complete();
}
finally
{
ConsoleHostFormatting.Disable(this, new[] { ConsoleFormattingFeature.Output });
}
}
}
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-FormattingExampleThis 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 every session
Install-Module ConsoleMonster -Scope CurrentUser
# Prints the lines that turn it on in every session; paste them into $PROFILE (notepad $PROFILE)
Enable-ConsoleFormatting -ProfileSnippetSee also: Enable-ConsoleFormatting
Before and after
'{"Name":"api-01","Settings":{"Region":"west"},"Tags":["blue","ready"]}' | ConvertFrom-Json
Before, Settings reads @{Region=west} and Tags reads {blue, ready}. After:
api-01
Settings Region=west
Tags blue, ready
Collections in a cell are joined (DNS, GC, PDC) with a +N marker for what does not fit, durations read as 42 s or 4 h 00 m, and status words get their symbol and colour. Get-ChildItem colours each name by its kind (folders, scripts, archives, images, hidden files). It, Get-Process, Get-Service and Get-WinEvent end with a line that sums up the result: sizes, memory, stopped services, errors and warnings. Everyday formatting lists every command with a view.
Arrays in cells and groups
Format-Table beside Show-ConsoleTable -GroupBy on the same objects: roles as a list, durations as durations, statuses with their symbol, one heading per site.
── Format-Table ──────────────────────────────────────────────────────────────────────────────────── Name Site Roles LastSync Status ---- ---- ----- -------- ------ DC01 Warsaw {DNS, GC, PDC} 00:00:42 Pass DC02 Warsaw {DNS, GC} 00:42:00 Warn DC03 Dublin {DNS, GC, RID, Infrastructure…} 00:01:04 Pass DC04 Dublin {} 04:00:00 Fail ── Show-ConsoleTable -GroupBy Site ───────────────────────────────────────────────────────────────── ╭──────────────┬───────────────────────────────────────────┬───────────┬────────╮ │ Name │ Roles │ LastSync │ Status │ ├─ Dublin · 2 ─┼───────────────────────────────────────────┼───────────┼────────┤ │ DC03 │ DNS, GC, RID, Infrastructure, Schema … +1 │ 1 m 04 s │ ✓ Pass │ │ DC04 │ │ 4 h 00 m │ ✗ Fail │ ├─ Warsaw · 2 ─┼───────────────────────────────────────────┼───────────┼────────┤ │ DC01 │ DNS, GC, PDC │ 42 s │ ✓ Pass │ │ DC02 │ DNS, GC │ 42 m 00 s │ ▲ Warn │ ╰──────────────┴───────────────────────────────────────────┴───────────┴────────╯
Install-Module ConsoleMonster -Scope CurrentUser# Arrays in cells and groups: the built-in Format-Table beside Show-ConsoleTable, on the same objects.
$servers = @(
[pscustomobject] @{ Name = 'DC01'; Site = 'Warsaw'; Roles = 'DNS', 'GC', 'PDC'
LastSync = (New-TimeSpan -Seconds 42); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC02'; Site = 'Warsaw'; Roles = 'DNS', 'GC'
LastSync = (New-TimeSpan -Minutes 42); Status = 'Warn' }
[pscustomobject] @{ Name = 'DC03'; Site = 'Dublin'
Roles = 'DNS', 'GC', 'RID', 'Infrastructure', 'Schema', 'Naming'
LastSync = (New-TimeSpan -Seconds 64); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC04'; Site = 'Dublin'; Roles = @()
LastSync = (New-TimeSpan -Hours 4); Status = 'Fail' }
)
New-ConsoleRule -Title 'Format-Table' | Show-Console
$servers | Format-Table | Out-Host
New-ConsoleRule -Title 'Show-ConsoleTable -GroupBy Site' | Show-Console
$servers | Show-ConsoleTable -GroupBy SiteFull program
Import-Module ConsoleMonster
# Arrays in cells and groups: the built-in Format-Table beside Show-ConsoleTable, on the same objects.
$servers = @(
[pscustomobject] @{ Name = 'DC01'; Site = 'Warsaw'; Roles = 'DNS', 'GC', 'PDC'
LastSync = (New-TimeSpan -Seconds 42); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC02'; Site = 'Warsaw'; Roles = 'DNS', 'GC'
LastSync = (New-TimeSpan -Minutes 42); Status = 'Warn' }
[pscustomobject] @{ Name = 'DC03'; Site = 'Dublin'
Roles = 'DNS', 'GC', 'RID', 'Infrastructure', 'Schema', 'Naming'
LastSync = (New-TimeSpan -Seconds 64); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC04'; Site = 'Dublin'; Roles = @()
LastSync = (New-TimeSpan -Hours 4); Status = 'Fail' }
)
New-ConsoleRule -Title 'Format-Table' | Show-Console
$servers | Format-Table | Out-Host
New-ConsoleRule -Title 'Show-ConsoleTable -GroupBy Site' | Show-Console
$servers | Show-ConsoleTable -GroupBy SiteRun: pwsh ./shaping.ps1
// A compiled cmdlet: the current PowerShell runspace owns native commands and callbacks.
[Cmdlet(VerbsLifecycle.Invoke, "ShapingExample")]
public sealed class ShapingExample : PSCmdlet
{
protected override void ProcessRecord()
{
var rows = InvokeCommand.InvokeScript(@"$servers = @(
[pscustomobject] @{ Name = 'DC01'; Site = 'Warsaw'; Roles = 'DNS', 'GC', 'PDC'; LastSync = (New-TimeSpan -Seconds 42); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC02'; Site = 'Warsaw'; Roles = 'DNS', 'GC'; LastSync = (New-TimeSpan -Minutes 42); Status = 'Warn' }
[pscustomobject] @{ Name = 'DC03'; Site = 'Dublin'; Roles = 'DNS', 'GC', 'RID', 'Infrastructure', 'Schema', 'Naming'; LastSync = (New-TimeSpan -Seconds 64); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC04'; Site = 'Dublin'; Roles = @(); LastSync = (New-TimeSpan -Hours 4); Status = 'Fail' }
)
$servers").ToList();
Terminal.Write(ConsoleHostViews.Table(
rows,
new ConsoleTableViewOptions { GroupBy = "Site" }));
}
}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, "ShapingExample")]
public sealed class ShapingExample : PSCmdlet
{
protected override void ProcessRecord()
{
var rows = InvokeCommand.InvokeScript(@"$servers = @(
[pscustomobject] @{ Name = 'DC01'; Site = 'Warsaw'; Roles = 'DNS', 'GC', 'PDC'; LastSync = (New-TimeSpan -Seconds 42); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC02'; Site = 'Warsaw'; Roles = 'DNS', 'GC'; LastSync = (New-TimeSpan -Minutes 42); Status = 'Warn' }
[pscustomobject] @{ Name = 'DC03'; Site = 'Dublin'; Roles = 'DNS', 'GC', 'RID', 'Infrastructure', 'Schema', 'Naming'; LastSync = (New-TimeSpan -Seconds 64); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC04'; Site = 'Dublin'; Roles = @(); LastSync = (New-TimeSpan -Hours 4); Status = 'Fail' }
)
$servers").ToList();
Terminal.Write(ConsoleHostViews.Table(
rows,
new ConsoleTableViewOptions { GroupBy = "Site" }));
}
}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-ShapingExampleThis 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, "ShapingExample")]
public sealed class ShapingExample : PSCmdlet
{
protected override void ProcessRecord()
{
var rows = InvokeCommand.InvokeScript(@"$servers = @(
[pscustomobject] @{ Name = 'DC01'; Site = 'Warsaw'; Roles = 'DNS', 'GC', 'PDC'; LastSync = (New-TimeSpan -Seconds 42); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC02'; Site = 'Warsaw'; Roles = 'DNS', 'GC'; LastSync = (New-TimeSpan -Minutes 42); Status = 'Warn' }
[pscustomobject] @{ Name = 'DC03'; Site = 'Dublin'; Roles = 'DNS', 'GC', 'RID', 'Infrastructure', 'Schema', 'Naming'; LastSync = (New-TimeSpan -Seconds 64); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC04'; Site = 'Dublin'; Roles = @(); LastSync = (New-TimeSpan -Hours 4); Status = 'Fail' }
)
$servers").ToList();
ConsoleHostViews.Table(rows, new ConsoleTableViewOptions().GroupBy("Site")).Show();
}
}
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, "ShapingExample")]
public sealed class ShapingExample : PSCmdlet
{
protected override void ProcessRecord()
{
var rows = InvokeCommand.InvokeScript(@"$servers = @(
[pscustomobject] @{ Name = 'DC01'; Site = 'Warsaw'; Roles = 'DNS', 'GC', 'PDC'; LastSync = (New-TimeSpan -Seconds 42); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC02'; Site = 'Warsaw'; Roles = 'DNS', 'GC'; LastSync = (New-TimeSpan -Minutes 42); Status = 'Warn' }
[pscustomobject] @{ Name = 'DC03'; Site = 'Dublin'; Roles = 'DNS', 'GC', 'RID', 'Infrastructure', 'Schema', 'Naming'; LastSync = (New-TimeSpan -Seconds 64); Status = 'Pass' }
[pscustomobject] @{ Name = 'DC04'; Site = 'Dublin'; Roles = @(); LastSync = (New-TimeSpan -Hours 4); Status = 'Fail' }
)
$servers").ToList();
ConsoleHostViews.Table(rows, new ConsoleTableViewOptions().GroupBy("Site")).Show();
}
}
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-ShapingExampleThis 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-ConsoleTable
Keep it on in every session
Print the lines for your profile. Nothing is written for you:
Enable-ConsoleFormatting -ProfileSnippetOpen your profile, creating it if it does not exist yet:
if (-not (Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force } notepad $PROFILEAny editor works; on macOS and Linux use
code $PROFILEornano $PROFILE.Paste the printed lines, save, and start a new PowerShell session.
The same lines work in Windows PowerShell 5.1 and PowerShell 7. Each has its own $PROFILE, so add them to both if you use both.
Turn parts off
Each part can be left out, in the profile line or later in the session:
| To | Run |
|---|---|
Keep Format-Table, Format-List and Format-Wide native | Enable-ConsoleFormatting -Exclude FormatCommands |
| Show only the views you register yourself | Enable-ConsoleFormatting -NoBuiltIn |
| Turn one feature off for this session | Disable-ConsoleFormatting -Feature Streams |
| See what is on | Get-ConsoleFormatting |
| Go back to PowerShell's output | Disable-ConsoleFormatting |
-Include adds the opt-in features: GridView (Out-GridView in the terminal where the desktop grid is unavailable), Progress, Help and Prompt. Add the same parameters to -ProfileSnippet to print matching profile lines.
For a view on demand, without the switch, use Show-ConsoleTable or Show-Console -View List. To export a view as Markdown or HTML, see Coming from Format-Table.
Next
- Everyday formatting reference: every built-in view, its summary line and the features.
- Restyle any command's output: a view for a command that has none.
- Coming from Format-Table: the Format commands and column options.
- Choose a theme: the colours the views use.