Skip to content
ConsoleMonster

Everyday PowerShell output

Enable-ConsoleFormatting makes everyday output readable and sums it up: folder trees, processes, services, events, JSON, history, jobs, drives and certificates.

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.

Enable-ConsoleFormatting 100×4024-bitFull
PowerShellformatting.ps1View on GitHub
# 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 }
C#formatting.host.csView on GitHub
// 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.

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-FormattingExample

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# fluentformatting.host.cs
// 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.

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-FormattingExample

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 every session

PowerShell 5.1 and 7
Install-Module ConsoleMonster -Scope CurrentUser
# Prints the lines that turn it on in every session; paste them into $PROFILE (notepad $PROFILE)
Enable-ConsoleFormatting -ProfileSnippet

See 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.

Show-ConsoleTable -GroupBy Site 100×1924-bitFull
Install-Module ConsoleMonster -Scope CurrentUser
PowerShellshaping.ps1View on GitHub
# 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 Site
Full 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 Site

Run: pwsh ./shaping.ps1

C#shaping.host.csView on GitHub
// 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.

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-ShapingExample

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# fluentshaping.host.cs
// 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.

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-ShapingExample

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.

Keep it on in every session

  1. Print the lines for your profile. Nothing is written for you:

    Enable-ConsoleFormatting -ProfileSnippet
    
  2. Open your profile, creating it if it does not exist yet:

    if (-not (Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force }
    notepad $PROFILE
    

    Any editor works; on macOS and Linux use code $PROFILE or nano $PROFILE.

  3. 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:

ToRun
Keep Format-Table, Format-List and Format-Wide nativeEnable-ConsoleFormatting -Exclude FormatCommands
Show only the views you register yourselfEnable-ConsoleFormatting -NoBuiltIn
Turn one feature off for this sessionDisable-ConsoleFormatting -Feature Streams
See what is onGet-ConsoleFormatting
Go back to PowerShell's outputDisable-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

Edit this page on GitHub