external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
psscripttools |
2.0.0 |
Shows the specified path as a tree.
Show-Tree [[-Path] <String[]>] [[-Depth] <Int32>] [-IndentSize <Int32>] [-ShowItem] [-ShowProperty]
[<CommonParameters>]
Show-Tree [[-LiteralPath] <String[]>] [[-Depth] <Int32>] [-IndentSize <Int32>] [-ShowItem] [-ShowProperty]
[<CommonParameters>]
Shows the specified path as a graphical tree in the console. This is intended as PowerShell alternative to the tree DOS command. This function should work for any type of PowerShell provider and can be used to explore providers used for configuration like the WSMan provider or the registry. Currently, this will not work with any PSDrives created with the Certificate provider.
By default, the output will only show directory or equivalent structures. But you can opt to include items well as item details.
It should work cross-platform.
Note: This is an update to an older function in my library. I seem to recall I found the original code somewhere online, perhaps from someone like Lee Holmes. Sadly, I neglected to record the source.
PS C:\> Show-Tree C:\Work -Depth 2
C:\work
+--A
| \--B
+--dnssuffix
| +--docs
| +--en-us
| \--images
+--gpo
| +--{65D9E940-AAD4-4508-A199-86EAE4E9E535}
| \--{7E7F01CE-6889-44B0-9D03-818F8284EDE0}
+--installers
+--remoteop
| \--archive
+--test files
\--tryme
+--.vscode
+--docs
+--en-us
\--test
Shows the directory tree structure, recursing down two levels.
PS C:\> Show-Tree HKLM:\SOFTWARE\Microsoft\.NETFramework -Depth 2 -ShowProperty
HKLM:\SOFTWARE\Microsoft\.NETFramework
+--Property: Enable64Bit = 1
+--Property: InstallRoot = C:\Windows\Microsoft.NET\Framework64\
+--Property: UseRyuJIT = 1
+--Property: DbgManagedDebugger = "C:\WINDOWS\system32\vsjitdebugger.exe" PID %d APPDOM %d EXTEXT "%s" EVTHDL %d
+--Property: DbgJITDebugLaunchSetting = 16
+--Advertised
| +--Policy
| \--v2.0.50727
+--AssemblyFolders
| +--ADOMD.Client 14.0
| | \--Property: (default) = C:\Program Files\Microsoft.NET\ADOMD.NET\140\
| +--Microsoft .NET Framework 3.5 Reference Assemblies
| | \--Property: (default) = C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\
| +--SQL Server Assemblies 140
| | \--Property: (default) = C:\Program Files\Microsoft SQL Server\140\SDK\Assemblies\
| +--v3.0
| | +--Property: <IncludeDotNet2Assemblies> = 1
| | \--Property: All Assemblies In = C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\
| \--v3.5
| +--Property: <IncludeDotNet2Assemblies> = 1
| \--Property: All Assemblies In = C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\
+--NGen
| \--Policy
+--NGenQueue
| +--WIN32
| \--WIN64
...
Shows the hierarchy of registry keys and values (-ShowProperty), recursing down two levels.
PS C:\> Show-Tree.ps1 WSMan: -ShowItem
WSMan:\
\--localhost
+--MaxEnvelopeSizekb
+--MaxTimeoutms
+--MaxBatchItems
+--MaxProviderRequests
+--Client
| +--NetworkDelayms
| +--URLPrefix
| +--AllowUnencrypted
| +--Auth
| | +--Basic
| | +--Digest
| | +--Kerberos
| | +--Negotiate
| | +--Certificate
| | \--CredSSP
| +--DefaultPorts
| | +--HTTP
| | \--HTTPS
| \--TrustedHosts
+--Service
| +--RootSDDL
| +--MaxConcurrentOperations
| +--MaxConcurrentOperationsPerUser
| +--EnumerationTimeoutms
...
Shows all the containers and items in the WSMan: drive.
The path to the root of the tree that will be shown.
Type: String[]
Parameter Sets: Path
Aliases:
Required: False
Position: 1
Default value: current location
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Use a literal path value.
Type: String[]
Parameter Sets: LiteralPath
Aliases: PSPath
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies how many levels of the specified path are recursed and shown.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: 2147483647
Accept pipeline input: False
Accept wildcard characters: False
The size of the indent per level. The default is 3. Minimum value is 1. You shouldn't have to modify this parameter.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 3
Accept pipeline input: False
Accept wildcard characters: False
Shows the items in each container or folder.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Shows the properties on containers and items (if -ShowItem is specified).
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/