1+ function Export-AbrVb365Diagram {
2+ <#
3+ . SYNOPSIS
4+ Used by As Built Report to export Veeam VB365 infrastructure diagram
5+ . DESCRIPTION
6+ Documents the configuration of Veeam VB365 in Word/HTML/Text formats using PScribo.
7+ . NOTES
8+ Version: 0.3.11
9+ Author: Jonathan Colon
10+ Twitter: @jcolonfzenpr
11+ Github: rebelinux
12+ Credits: Iain Brighton (@iainbrighton) - PScribo module
13+
14+ . LINK
15+ https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VB365
16+ #>
17+ [CmdletBinding ()]
18+ param (
19+ )
20+
21+ begin {
22+ Write-PScriboMessage - Message " EnableDiagrams set to $ ( $Options.EnableDiagrams ) ."
23+ }
24+
25+ process {
26+ if ($Options.EnableDiagrams ) {
27+ Write-PScriboMessage - Message " Collecting Veeam Infrastructure diagram"
28+
29+ # Variable translating Icon to Image Path ($IconPath)
30+ $script :Images = @ {
31+ " VB365_Server" = " VBR_server.png"
32+ " VB365_Proxy_Server" = " Proxy_Server.png"
33+ " VB365_Proxy" = " Veeam_Proxy.png"
34+ " VBR_LOGO" = " Veeam_logo_new.png"
35+ " VB365_LOGO_Footer" = " verified_recoverability.png"
36+ " VB365_Repository" = " VBO_Repository.png"
37+ " VB365_Windows_Repository" = " Windows_Repository.png"
38+ " VB365_Object_Repository" = " Object_Storage.png"
39+ " VB365_Object_Support" = " Object Storage support.png"
40+ " Veeam_Repository" = " Veeam_Repository.png"
41+ " VB365_On_Premises" = " SMB.png"
42+ " VB365_Microsoft_365" = " Cloud.png"
43+ " Microsoft_365" = " Microsoft_365.png"
44+ " Datacenter" = " Datacenter.png"
45+ " VB365_Restore_Portal" = " Web_console.png"
46+ " VB365_User_Group" = " User_Group.png"
47+ " VB365_User" = " User.png"
48+ " VBR365_Amazon_S3_Compatible" = " S3-compatible.png"
49+ " VBR365_Amazon_S3" = " AWS S3.png"
50+ " VBR365_Azure_Blob" = " Azure Blob.png"
51+ }
52+
53+ $RootPath = Split-Path (Split-Path $PSScriptRoot - Parent) - Parent
54+ [System.IO.FileInfo ]$IconPath = Join-Path $RootPath ' icons'
55+
56+ $DiagramParams = @ {
57+ ' FileName' = " AsBuiltReport.Veeam.VB365"
58+ ' OutputFolderPath' = $OutputFolderPath
59+ ' Direction' = ' top-to-bottom'
60+ ' MainDiagramLabel' = ' Backup for Microsoft 365'
61+ ' MainDiagramLabelFontsize' = 28
62+ ' MainDiagramLabelFontcolor' = ' #565656'
63+ ' MainDiagramLabelFontname' = ' Segoe UI Black'
64+ ' IconPath' = $IconPath
65+ ' ImagesObj' = $Images
66+ ' LogoName' = ' VBR_LOGO'
67+ ' SignatureLogoName' = ' VB365_LOGO_Footer'
68+ ' WaterMarkText' = $Options.DiagramWaterMark
69+ }
70+
71+ if ($Options.DiagramTheme -eq ' Black' ) {
72+ $DiagramParams.add (' MainGraphBGColor' , ' Black' )
73+ $DiagramParams.add (' Edgecolor' , ' White' )
74+ $DiagramParams.add (' Fontcolor' , ' White' )
75+ $DiagramParams.add (' NodeFontcolor' , ' White' )
76+ $DiagramParams.add (' WaterMarkColor' , ' White' )
77+ } elseif ($Options.DiagramTheme -eq ' Neon' ) {
78+ $DiagramParams.add (' MainGraphBGColor' , ' grey14' )
79+ $DiagramParams.add (' Edgecolor' , ' gold2' )
80+ $DiagramParams.add (' Fontcolor' , ' gold2' )
81+ $DiagramParams.add (' NodeFontcolor' , ' gold2' )
82+ $DiagramParams.add (' WaterMarkColor' , ' #FFD700' )
83+ } else {
84+ $DiagramParams.add (' WaterMarkColor' , ' DarkGreen' )
85+ }
86+
87+ if ($Options.ExportDiagrams ) {
88+ if (-Not $Options.ExportDiagramsFormat ) {
89+ $DiagramFormat = ' png'
90+ } else {
91+ $DiagramFormat = $Options.ExportDiagramsFormat
92+ }
93+ $DiagramParams.Add (' Format' , $DiagramFormat )
94+ } else {
95+ $DiagramParams.Add (' Format' , " base64" )
96+ }
97+
98+ if ($Options.EnableDiagramDebug ) {
99+
100+ $DiagramParams.Add (' EnableEdgeDebug' , $True )
101+ $DiagramParams.Add (' EnableSubGraphDebug' , $True )
102+
103+ }
104+
105+ if ($Options.EnableDiagramSignature ) {
106+ $DiagramParams.Add (' Signature' , $True )
107+ $DiagramParams.Add (' AuthorName' , $Options.SignatureAuthorName )
108+ $DiagramParams.Add (' CompanyName' , $Options.SignatureCompanyName )
109+ }
110+
111+ if ($Options.ExportDiagrams ) {
112+ Try {
113+ Write-PScriboMessage - Message " Generating Veeam Infrastructure diagram"
114+ $Graph = Get-AbrVb365Diagram
115+ if ($Graph ) {
116+ Write-PScriboMessage - Message " Saving Veeam Infrastructure diagram"
117+ $Diagram = New-Diagrammer @DiagramParams - InputObject $Graph
118+ if ($Diagram ) {
119+ foreach ($OutputFormat in $DiagramFormat ) {
120+ Write-Information - MessageData " Saved 'AsBuiltReport.Veeam.VB365.$ ( $OutputFormat ) ' diagram to '$ ( $OutputFolderPath ) '." - InformationAction Continue
121+ }
122+ }
123+ }
124+ } Catch {
125+ Write-PScriboMessage - IsWarning - Message " Unable to export the Infrastructure Diagram: $ ( $_.Exception.Message ) "
126+ }
127+ }
128+ try {
129+ $DiagramParams.Remove (' Format' )
130+ $DiagramParams.Add (' Format' , " base64" )
131+
132+ $Graph = Get-AbrVb365Diagram
133+ $Diagram = New-Diagrammer @DiagramParams - InputObject $Graph
134+ if ($Diagram ) {
135+ If ((Get-DiaImagePercent - GraphObj $Diagram ).Width -gt 1500 ) { $ImagePrty = 20 } else { $ImagePrty = 50 }
136+ Section - Style Heading1 " Infrastructure Diagram." - Orientation Landscape {
137+ Image - Base64 $Diagram - Text " Veeam Backup for Microsoft 365 Diagram" - Percent $ImagePrty - Align Center
138+ Paragraph " Image preview: Opens the image in a new tab to view it at full resolution." - Tabs 2
139+ }
140+ }
141+ } catch {
142+ Write-PScriboMessage - IsWarning - Message " Unable to generate the Infrastructure Diagram: $ ( $_.Exception.Message ) "
143+ }
144+ }
145+ }
146+
147+ end {}
148+ }
0 commit comments