Skip to content
ConsoleMonster
Cmdlet

Show-ConsoleTree

Module
ConsoleMonster
Inputs
System.Management.Automation.PSObject

Shows a hierarchy from objects, dictionaries or explicit tree nodes.

Syntax

Show-ConsoleTree
[-AsString]
[-AsWidget]
[[-Content] <ScriptBlock>]
[-Culture <CultureInfo>]
[-Exclude <String[]>]
[-Include <String[]>]
[-PassThru]
[[-Title] <Object>]
[-Width <Int32>]
[<CommonParameters>]
#
Parameter set: Nodes
Show-ConsoleTree
[-AsString]
[-AsWidget]
[-Children <ScriptBlock>]
[-ChildrenProperty <String>]
[-Culture <CultureInfo>]
[-Depth <Int32>]
[-DetailProperty <String>]
[-Exclude <String[]>]
[-Include <String[]>]
-InputObject <PSObject>
[-LabelProperty <String>]
[-MaxItems <Int32>]
[-MaxNodes <Int32>]
[-PassThru]
[-StatusProperty <String>]
[[-Title] <Object>]
[-Width <Int32>]
[<CommonParameters>]
#
Parameter set: Objects

Description

Use ChildrenProperty or Children for a hierarchy, Content for New-ConsoleTreeNode definitions, or InputObject for a nested dictionary or object graph. Object inspection is bounded by Depth, MaxItems and MaxNodes. Show-ConsoleObject provides the keyboard explorer.

Examples

Example 1

$configuration | Show-ConsoleTree -Depth 4

Display an object graph.

Example 2

Show-ConsoleTree 'Checks' -Content { New-ConsoleTreeNode 'DNS' -Status Pass }

Show explicit nodes.

Parameters

-AsString SwitchParameter optional
Returns one plain-text string without drawing.
-AsWidget SwitchParameter optional
Returns the tree widget without drawing.
-Content ScriptBlock optionalposition: 1sets: Nodes
A script block that emits the nodes: New-ConsoleTreeNode calls, or strings for leaves (shown literally).
-Culture CultureInfo optional
Culture used for values.
-Exclude String[] optional
Member names to omit without reading their getters.
-Include String[] optional
Member names to include when inspecting an object graph.
-PassThru SwitchParameter optional
Returns the original pipeline objects after drawing.
-Title Object optionalposition: 0
The root label (markup allowed; rich text from New-ConsoleText keeps its colours). Without it the top-level nodes are the roots.
-Width Int32 optional
Layout width in cells; zero resolves the current target, falling back to 100.
-Children ScriptBlock optionalsets: Objects
A script block that returns an object's children; $_ is the object. Use it when children have to be looked up (Get-ChildItem, Get-ADGroupMember).
-ChildrenProperty String optionalsets: Objects
The property that holds an object's children (for example Members or Children).
-Depth Int32 optionalsets: Objects
Levels of children to follow: New-ConsoleTree defaults to 5. Show-ConsoleTree defaults to 3 for object graphs, or one for wide .NET objects when Depth is omitted.
-DetailProperty String optionalsets: Objects
The property shown as a muted note after the label.
-InputObject PSObject requiredpipeline: True (ByValue)sets: Objects
Hierarchical objects (pipeline input); each becomes a top-level node. Nodes from New-ConsoleTreeNode go in as they are.
-LabelProperty String optionalsets: Objects
The property shown as the node label (default: the object's name, as tables title a record: Name, DisplayName, Title...).
-MaxItems Int32 optionalsets: Objects
The most children listed per node, and objects listed at the top, before "+N more" (default 25; 0 lists all).
-MaxNodes Int32 optionalsets: Objects
The most nodes the tree may grow to (default 5000; 0 for no limit); beyond it a "node limit reached" note ends the walk.
-StatusProperty String optionalsets: Objects
The property whose value is the node status (pass, fail, warn, skip... or PowerShell's words).

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.