Project

PSWriteHTML

Generate HTML reports, dashboards, and emails from PowerShell without writing HTML, CSS, or JavaScript.

Stars 1,023
Forks 115
Open issues 54
PowerShell Gallery downloads 7,576,901
Release v1.45.0
Language: PowerShell Updated: 2026-11-03
Command

New-HTMLTreeNode

Module
PSWriteHTML

Creates a new HTML tree node with specified properties.

Syntax

New-HTMLTreeNode
[[-Checkbox] <checkbox|radio>]
[[-Children] <ScriptBlock>]
[-Folder]
[[-HrefLink] <String>]
[[-Icon] <String>]
[[-IconTooltip] <String>]
[[-Id] <String>]
[-IsExpanded]
[-IsSelected]
[[-Target] <String>]
[[-Title] <String>]
[[-Tooltip] <String>]
[-Unselectable]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

This function creates a new HTML tree node with the specified properties. It allows for customization of various attributes such as title, ID, folder structure, tooltip, icon, selection status, expansion status, etc.

Examples

Example 1

New-HTMLTreeNode -Title "Folder 1" -Id "folder1" -Folder -Children {
    New-HTMLTreeNode -Title "Item 1" -Id "item1"
    New-HTMLTreeNode -Title "Item 2" -Id "item2"
}

Example 2

New-HTMLTreeNode -Title "Document" -Id "doc1" -HrefLink "https://example.com" -Target "_blank"

Parameters

-Checkbox String optionalposition: 6
Specifies the type of checkbox for the tree node. Valid values are 'none', 'checkbox', or 'radio'.
Possible values: checkbox, radio
-Children ScriptBlock optionalposition: 0
Specifies the script block that defines the children nodes of the tree node.
-Folder SwitchParameter optional
Indicates whether the tree node represents a folder.
Specifies the URL link for the tree node.
-Icon String optionalposition: 4
Specifies the icon for the tree node.
-IconTooltip String optionalposition: 5
Specifies the tooltip text for the icon.
-Id String optionalposition: 2
Specifies the unique identifier of the tree node.
-IsExpanded SwitchParameter optionalaliases: Expanded
Indicates whether the tree node is expanded.
-IsSelected SwitchParameter optional
Indicates whether the tree node is selected.
-Target String optionalposition: 8
Specifies the target window for the URL link. Valid values are "_blank", "_self", "_parent", "_top", or a frame name.
-Title String optionalposition: 1
Specifies the title of the tree node.
-Tooltip String optionalposition: 3
Specifies the tooltip text for the tree node.
-Unselectable SwitchParameter optional
Indicates whether the tree node is unselectable.

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.