Cmdlet
Show-ConsoleTree
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:
NodesShow-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:
ObjectsDescription
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 4Display an object graph.
Example 2
Show-ConsoleTree 'Checks' -Content { New-ConsoleTreeNode 'DNS' -Status Pass }Show explicit nodes.
Parameters
- -AsString SwitchParameter
- Returns one plain-text string without drawing.
- -AsWidget SwitchParameter
- Returns the tree widget without drawing.
- -Content ScriptBlock
- A script block that emits the nodes: New-ConsoleTreeNode calls, or strings for leaves (shown literally).
- -Culture CultureInfo
- Culture used for values.
- -Exclude String[]
- Member names to omit without reading their getters.
- -Include String[]
- Member names to include when inspecting an object graph.
- -PassThru SwitchParameter
- Returns the original pipeline objects after drawing.
- -Title Object
- The root label (markup allowed; rich text from New-ConsoleText keeps its colours). Without it the top-level nodes are the roots.
- -Width Int32
- Layout width in cells; zero resolves the current target, falling back to 100.
- -Children ScriptBlock
- 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
- The property that holds an object's children (for example Members or Children).
- -Depth Int32
- 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
- The property shown as a muted note after the label.
- -InputObject PSObject
- Hierarchical objects (pipeline input); each becomes a top-level node. Nodes from New-ConsoleTreeNode go in as they are.
- -LabelProperty String
- The property shown as the node label (default: the object's name, as tables title a record: Name, DisplayName, Title...).
- -MaxItems Int32
- The most children listed per node, and objects listed at the top, before "+N more" (default 25; 0 lists all).
- -MaxNodes Int32
- 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
- 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.