Src/Private/Diagram/Get-AbrDiagForest.ps1
|
function Get-AbrDiagForest { <# .SYNOPSIS Function to diagram Microsoft Active Directory Forest. .DESCRIPTION Build a diagram of the configuration of Microsoft Active Directory to a supported formats using Psgraph. .NOTES Version: 1.0.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux .LINK https://github.com/rebelinux/Diagrammer.Microsoft.AD #> [CmdletBinding()] [OutputType([System.Object[]])] param ( ) begin { Write-Verbose ($reportTranslate.NewADDiagram.gereratingDiagram -f 'Forest') } process { Write-Verbose -Message ($reportTranslate.NewADDiagram.connectingDomain -f $($ForestRoot)) try { if ($ForestRoot) { $ForestInfo = Get-AbrADForestInfo if ($ForestInfo) { SubGraph ForestSubGraph -Attributes @{Label = (Add-HtmlLabel -ImagesObj $Images -Label $ForestRoot -IconType 'ForestRoot' -IconDebug $IconDebug -SubgraphLabel -IconWidth 50 -IconHeight 50 -Fontsize 22 -FontName 'Segoe UI' -FontColor $Fontcolor -FontBold -TableBackgroundColor $MainGraphBGColor -CellBackgroundColor $MainGraphBGColor) ; fontsize = 24; penwidth = 1.5; labelloc = 't'; style = $SubGraphDebug.style ; color = $SubGraphDebug.color } { SubGraph MainSubGraph -Attributes @{Label = ' ' ; fontsize = 24; penwidth = 1.5; labelloc = 't'; style = $SubGraphDebug.style; color = $SubGraphDebug.color } { if ($ForestInfo.ChildDomain ) { $ForestRootDomain = Remove-SpecialCharacter -String "$($ForestInfo[0].RootDomain)ChildDomain" -SpecialChars '\-. ' Add-NodeIcon -Name $ForestRootDomain -IconType 'NoIcon' -ImagesObj $Images -NodeObject -GraphvizAttributes @{Label = ($ForestInfo[0]).RootDomainLabel; shape = 'plain'; fillColor = 'transparent' } foreach ($ForestObj in $ForestInfo) { $ParentDomain = Remove-SpecialCharacter -String "$($ForestObj.ParentDomain)" -SpecialChars '\-. ' Add-NodeIcon -Name $ForestObj.Name -IconType 'NoIcon' -ImagesObj $Images -NodeObject -GraphvizAttributes @{Label = $ForestObj.Label; shape = 'plain'; fillColor = 'transparent' } Add-NodeEdge -From $ParentDomain -To $ForestObj.Name -EdgeLength 2 -EdgeStyle 'dashed' -EdgeColor $Edgecolor -EdgeThickness 2 -Arrowhead 'normal' -Arrowtail 'dot' } } else { Add-NodeIcon -Name $ForestInfo.Name -IconType 'NoIcon' -ImagesObj $Images -NodeObject -GraphvizAttributes @{Label = $ForestInfo.Label; shape = 'plain'; fillColor = 'transparent' } Add-NodeIcon -Name 'NoDomain' -IconType 'NoIcon' -ImagesObj $Images -NodeObject -GraphvizAttributes @{Label = $reportTranslate.NewADDiagram.fNoChildDomains; shape = 'rectangle'; labelloc = 'c'; fixedsize = $true; width = '3'; height = '2'; fillColor = 'transparent'; penwidth = 1.5; style = 'dashed'; color = $Edgecolor } Add-NodeEdge -From $ForestInfo.Name -To 'NoDomain' -EdgeLength 2 -EdgeStyle 'dashed' -EdgeColor $Edgecolor -EdgeThickness 2 -Arrowhead 'normal' -Arrowtail 'dot' } } } } else { Add-NodeIcon -Name 'NoDomain' -IconType 'NoIcon' -ImagesObj $Images -NodeObject -GraphvizAttributes @{Label = $reportTranslate.NewADDiagram.fNoChildDomains; shape = 'rectangle'; labelloc = 'c'; fixedsize = $true; width = '15'; height = '13'; fillColor = 'transparent'; penwidth = 1.5; style = 'dashed'; color = $Edgecolor } } } } catch { Write-Verbose $_.Exception.Message } } end {} } |