Project

PSWriteHTML

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

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

New-HTMLOrgChart

Module PSWriteHTML

Creates an HTML organizational chart based on the provided nodes and options.

Syntax

New-HTMLOrgChart [-AllowExport] [[-ChartID] <String>] [[-ChartNodes] <ScriptBlock>] [[-Direction] <TopToBottom|BottomToTop|LeftToRight|RightToLeft>] [-Draggable] [[-ExportExtension] <png|pdf>] [[-ExportFileName] <String>] [[-NodeTitle] <String>] [-Pan] [-ToggleSiblings] [[-VerticalLevel] <Int32>] [[-VisileLevel] <Int32>] [-Zoom] [[-ZoomInLimit] <Double>] [[-ZoomOutLimit] <Double>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

This function generates an interactive HTML organizational chart based on the specified nodes and customization options. Users can define the layout direction, initial visibility level, vertical alignment, and various interactive features like panning, zooming, dragging, and exporting.

Examples

Authored help example

EXAMPLE 1

New-HTML {
    New-HTMLOrgChart {
        New-OrgChartNode -Name 'CEO' -Title 'Chief Executive Officer' {
            New-OrgChartNode -Name 'Manager' -Title 'Manager'
            New-OrgChartNode -Name 'Supervisor' -Title 'Supervisor'
            New-OrgChartNode -Name 'Employee' -Title 'Employee' {
                New-OrgChartNode -Name 'Assistant' -Title 'Assistant'
            }
        }
    } -AllowExport -ExportExtension pdf -Draggable
} -FilePath $PSScriptRoot\OrgChart.html -ShowHTML -Online

Parameters

-AllowExport SwitchParameter optional
Enables the export button for the org chart.
-ChartID String optionalposition: 9
Specifies a custom ID for the org chart. If not provided, a random ID will be generated.
-ChartNodes ScriptBlock optionalposition: 0
Specifies the nodes to be displayed on the chart. This parameter should contain a script block defining the organizational structure.
-Direction String optionalposition: 1
Specifies the layout direction of the chart. Available values are "TopToBottom" (default), "BottomToTop", "LeftToRight", and "RightToLeft".
Possible values: TopToBottom, BottomToTop, LeftToRight, RightToLeft
-Draggable SwitchParameter optional
Enables dragging and dropping nodes within the org chart. Note: This feature is not supported on Internet Explorer.
-ExportExtension Object optionalposition: 8
Specifies the format for exporting the org chart. Available values are "png" and "pdf".
Possible values: png, pdf
-ExportFileName String optionalposition: 7
Specifies the filename when exporting the org chart as an image.
-NodeTitle String optionalposition: 4
Sets the text content of the title section of each org chart node.
-Pan SwitchParameter optional
Enables panning the org chart by mouse drag and drop.
-ToggleSiblings SwitchParameter optional
Enables the ability to show/hide left and right sibling nodes by clicking arrows.
-VerticalLevel Int32 optionalposition: 3
Aligns the nodes vertically starting from the specified level.
-VisileLevel Int32 optionalposition: 2
Sets the initial visibility level of the org chart.
-Zoom SwitchParameter optional
Enables zooming in and out of the org chart using the mouse wheel.
-ZoomInLimit Double optionalposition: 5
Sets the maximum zoom-in limit.
-ZoomOutLimit Double optionalposition: 6
Sets the maximum zoom-out limit.

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.