Display any tree with PowerShell

I have on my computer the excellent PSScriptTools module from Jeff Hicks since a while.
It contains so many useful cmdlets!

And I was already using the Show-Tree cmdlet, but I was not aware that it can display the tree of any PSProvider…

Try it yourself! It is so easy…

Install-Module -Name PSScriptTools

File system

Show-Tree 'C:\ProgramData\' -Path -Depth 3 -InColor

If you want also to display files:

Show-Tree 'C:\ProgramData\' -Path -Depth 3 -InColor -ShowItem

Active Directory

Show-Tree -Path 'AD:\' -Depth 3

VMWare VM folders

Show-Tree -Path 'vi:\' -Depth 3

If you want also to display the VMs in each folder:

Show-Tree -Path 'vi:\' -Depth 3 -ShowItem

VMWare data store

Show-Tree -Path 'vmstore:\' -Depth 3

If you want also to display files:

Show-Tree -Path 'vmstore:\' -Depth 3 -ShowItem

Registry

Show-Tree -Path 'HKLM:\SYSTEM\' -Depth 3

If you want also to display registry value names:

Show-Tree -Path 'HKLM:\SYSTEM\' -Depth 3 -ShowProperty *

WSMan configuration

Show-Tree -Path 'WSMan:\' -Depth 3

If you want also to display registry value names:

Show-Tree -Path 'WSMan:\' -Depth 3 -ShowItem

Caveats

Unfortunately, while the -InColor parameter is working fine in PowerShell 5.1, it has no impact in my PowerShell 7.3.4 session in the latest Windows Terminal 1.16.10261.0 console.

Also, with the current version (2.47.0), the -ShowItem has no impact when displaying Active Directory trees. It always displays computer and user accounts, and I could not find a way to display only Organizational Units, even with -ShowItem:$false.

I guess, Jeff will fix this as soon as he will find some time…

Or maybe concerning the Active Directory, Jeff will decide to add the Show-Domain function to the PSScriptTools module…

Conclusion

Show-Tree is a great cmdlet and I will be definitely more reluctant to open a GUI console :)
Also, I strongly encourage you to explore the other cmdlets from the PSScriptTools module.

Get-Command -Module PSScriptTools

You will soon become a PowerShell maximalist too… :)

Leave a comment