-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExample01.ps1
More file actions
52 lines (42 loc) · 2.13 KB
/
Example01.ps1
File metadata and controls
52 lines (42 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<#
This is a simple example demonstrating how to create a 3-tier web application diagram using the PSgraph module, without using any object icons.
#>
[CmdletBinding()]
param (
[System.IO.FileInfo] $Path = '~\Desktop\',
[array] $Format = @('png'),
[bool] $DraftMode = $false
)
<#
Starting with PowerShell v3, modules are auto-imported when needed. Importing the module here ensures clarity and avoids ambiguity.
#>
# Import-Module AsBuiltReport.Diagram -Force -Verbose:$false
<#
Since the diagram output is a file, specify the output folder path using $OutputFolderPath.
#>
$OutputFolderPath = Resolve-Path $Path
<#
The $MainGraphLabel variable sets the main title of the diagram.
#>
$MainGraphLabel = '3tier Web Application Diagram'
$example1 = & {
<#
This block creates a diagram with three servers, each represented by a custom node label and shape (without object icons).
#>
Node -Name 'Web-Server-01' -Attributes @{Label = 'Web-Server-01'; shape = 'rectangle'; fillColor = 'Green'; fontsize = 14 }
Node -Name 'App-Server-01' -Attributes @{Label = 'App-Server-01'; shape = 'rectangle'; fillColor = 'Blue'; fontsize = 14 }
Node -Name 'Db-Server-01' -Attributes @{Label = 'Db-Server-01'; shape = 'rectangle'; fillColor = 'Red'; fontsize = 14 }
}
<#
The New-AbrDiagram cmdlet generates the diagram.
-InputObject: Accepts the custom object defined above.
-OutputFolderPath: Specifies where to save the generated diagram.
-Format: Sets the output format (png, jpg, svg, etc.).
-ImagesObj: Passes a hashtable of images for custom icons.
-MainDiagramLabel: Sets the diagram's title.
-Filename: Specifies the output file name (without extension).
-LogoName: Selects an image from the hashtable to use as the diagram logo.
-DraftMode: If set to $true, generates a draft version of the diagram for troubleshooting.
If the specified logo image is not found, a default no_icon.png is used.
#>
New-AbrDiagram -InputObject $example1 -OutputFolderPath $OutputFolderPath -Format $Format -MainDiagramLabel $MainGraphLabel -Filename Example1 -LogoName 'Main_Logo' -DraftMode:$DraftMode