diff --git a/README.md b/README.md index 7718438..8816e2d 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ The Veeam.Diagrammer supports the following Veeam Backup & Replication version; ### :closed_lock_with_key: Required Privileges Only users with Veeam Backup Administrator role assigned can generate a Diagram + ### PowerShell This project is compatible with the following PowerShell versions; diff --git a/Src/Private/Convert-TableToHTML.ps1 b/Src/Private/Convert-TableToHTML.ps1 index 33dc7d8..4f85b6b 100644 --- a/Src/Private/Convert-TableToHTML.ps1 +++ b/Src/Private/Convert-TableToHTML.ps1 @@ -1,5 +1,4 @@ -function Convert-TableToHTML -{ +function Convert-TableToHTML { <# .SYNOPSIS Creates a html table object @@ -105,47 +104,38 @@ function Convert-TableToHTML $HeaderColor = "black", [string] - $HeaderFontColor="white", + $HeaderFontColor = "white", [string] - $BorderColor="white" + $BorderColor = "white" ) - begin - { + begin { $tableData = [System.Collections.ArrayList]::new() - if ( [string]::IsNullOrEmpty($Label) ) - { + if ( [string]::IsNullOrEmpty($Label) ) { $Label = $Name } } - process - { - if ( $null -ne $ScriptBlock ) - { + process { + if ( $null -ne $ScriptBlock ) { $Row = $ScriptBlock.Invoke() } - if ( $null -ne $RowScript ) - { - $Row = foreach ( $node in $Row ) - { + if ( $null -ne $RowScript ) { + $Row = foreach ( $node in $Row ) { @($node).ForEach($RowScript) } } - $results = foreach ( $node in $Row ) - { + $results = foreach ( $node in $Row ) { Row -Label $node } - foreach ( $node in $results ) - { + foreach ( $node in $results ) { [void]$tableData.Add($node) } } - end - { + end { $html = "{1}
{0}
" -f $Label, ($tableData -join '') - Node $Name @{label = $html; shape = 'none'; fontname = $Fontname; fontsize = $FontSize; style = $Style; penwidth = 1; fillcolor = $Fillcolor; color = $BorderColor} + Node $Name @{label = $html; shape = 'none'; fontname = $Fontname; fontsize = $FontSize; style = $Style; penwidth = 1; fillcolor = $Fillcolor; color = $BorderColor } } } \ No newline at end of file diff --git a/Src/Private/Get-DiagBackupToFileProxy.ps1 b/Src/Private/Get-DiagBackupToFileProxy.ps1 index c9bbbd6..01a6b6b 100644 --- a/Src/Private/Get-DiagBackupToFileProxy.ps1 +++ b/Src/Private/Get-DiagBackupToFileProxy.ps1 @@ -35,37 +35,36 @@ function Get-DiagBackupToFileProxy { fontsize = 18 penwidth = 1.5 labelloc = 't' - color=$SubGraphDebug.color - style='dashed,rounded' + color = $SubGraphDebug.color + style = 'dashed,rounded' } SubGraph MainSubGraph -Attributes $ProxiesAttr -ScriptBlock { # Dummy Node used for subgraph centering - node DummyFileProxy @{Label=$DiagramDummyLabel; fontsize=18; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node DummyFileProxy @{Label = $DiagramDummyLabel; fontsize = 18; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq "TB") { - node FileLeft @{Label='FileLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node FileLeftt @{Label='FileLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node FileRight @{Label='FileRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge FileLeft,FileLeftt,DummyFileProxy,FileRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank FileLeft,FileLeftt,DummyFileProxy,FileRight + Node FileLeft @{Label = 'FileLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node FileLeftt @{Label = 'FileLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node FileRight @{Label = 'FileRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge FileLeft, FileLeftt, DummyFileProxy, FileRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank FileLeft, FileLeftt, DummyFileProxy, FileRight } foreach ($ProxyObj in $FileBackupProxy) { $PROXYHASHTABLE = @{} $ProxyObj.psobject.properties | ForEach-Object { $PROXYHASHTABLE[$_.Name] = $_.Value } - node $ProxyObj -NodeScript {$_.Name} @{Label=$PROXYHASHTABLE.Label; fontname="Segoe Ui"} - edge -From DummyFileProxy -To $ProxyObj.Name @{constraint="true"; minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Node $ProxyObj -NodeScript { $_.Name } @{Label = $PROXYHASHTABLE.Label; fontname = "Segoe Ui" } + Edge -From DummyFileProxy -To $ProxyObj.Name @{constraint = "true"; minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } Rank $FileBackupProxy.Name } if ($Dir -eq 'LR') { - edge $BackupServerInfo.Name -to DummyFileProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyFileProxy @{minlen = 3; } } else { - edge $BackupServerInfo.Name -to DummyFileProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyFileProxy @{minlen = 3; } } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToHvProxy.ps1 b/Src/Private/Get-DiagBackupToHvProxy.ps1 index 9838fcf..311a14f 100644 --- a/Src/Private/Get-DiagBackupToHvProxy.ps1 +++ b/Src/Private/Get-DiagBackupToHvProxy.ps1 @@ -34,36 +34,35 @@ function Get-DiagBackupToHvProxy { fontsize = 18 penwidth = 1.5 labelloc = 't' - color=$SubGraphDebug.color - style='dashed,rounded' + color = $SubGraphDebug.color + style = 'dashed,rounded' } SubGraph MainSubGraph -Attributes $ProxiesAttr -ScriptBlock { # Dummy Node used for subgraph centering - node DummyHyperVProxy @{Label=$DiagramDummyLabel; fontsize=18; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node DummyHyperVProxy @{Label = $DiagramDummyLabel; fontsize = 18; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq "TB") { - node HvLeft @{Label='HvLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node HvLeftt @{Label='HvLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node HvRight @{Label='HvRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge HvLeft,HvLeftt,DummyHyperVProxy,HvRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank HvLeft,HvLeftt,DummyHyperVProxy,HvRight + Node HvLeft @{Label = 'HvLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node HvLeftt @{Label = 'HvLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node HvRight @{Label = 'HvRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge HvLeft, HvLeftt, DummyHyperVProxy, HvRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank HvLeft, HvLeftt, DummyHyperVProxy, HvRight } foreach ($ProxyObj in $HyperVBackupProxy) { $PROXYHASHTABLE = @{} $ProxyObj.psobject.properties | ForEach-Object { $PROXYHASHTABLE[$_.Name] = $_.Value } - node $ProxyObj -NodeScript {$_.Name} @{Label=$PROXYHASHTABLE.Label; fontname="Segoe Ui"} - edge -From DummyHyperVProxy -To $ProxyObj.Name @{constraint="true"; minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Node $ProxyObj -NodeScript { $_.Name } @{Label = $PROXYHASHTABLE.Label; fontname = "Segoe Ui" } + Edge -From DummyHyperVProxy -To $ProxyObj.Name @{constraint = "true"; minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } Rank $HyperVBackupProxy.Name } if ($Dir -eq 'LR') { - edge $BackupServerInfo.Name -to DummyHyperVProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyHyperVProxy @{minlen = 3; } } else { - edge $BackupServerInfo.Name -to DummyHyperVProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyHyperVProxy @{minlen = 3; } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToProtectedGroup.ps1 b/Src/Private/Get-DiagBackupToProtectedGroup.ps1 index c712162..ca94cfd 100644 --- a/Src/Private/Get-DiagBackupToProtectedGroup.ps1 +++ b/Src/Private/Get-DiagBackupToProtectedGroup.ps1 @@ -22,10 +22,10 @@ function Get-DiagBackupToProtectedGroup { try { $ProtectedGroups = Get-VbrBackupProtectedGroupInfo - $ADContainer = $ProtectedGroups | Where-Object {$_.Container -eq 'ActiveDirectory'} - $ManualContainer = $ProtectedGroups | Where-Object {$_.Container -eq 'ManuallyDeployed'} - $IndividualContainer = $ProtectedGroups | Where-Object {$_.Container -eq 'IndividualComputers'} - $CSVContainer = $ProtectedGroups | Where-Object {$_.Container -eq 'CSV'} + $ADContainer = $ProtectedGroups | Where-Object { $_.Container -eq 'ActiveDirectory' } + $ManualContainer = $ProtectedGroups | Where-Object { $_.Container -eq 'ManuallyDeployed' } + $IndividualContainer = $ProtectedGroups | Where-Object { $_.Container -eq 'IndividualComputers' } + $CSVContainer = $ProtectedGroups | Where-Object { $_.Container -eq 'CSV' } try { $FileBackupProxy = Get-VbrBackupProxyInfo -Type 'nas' @@ -43,40 +43,39 @@ function Get-DiagBackupToProtectedGroup { fontsize = 18 penwidth = 1.5 labelloc = 't' - color=$SubGraphDebug.color - style='dashed,rounded' + color = $SubGraphDebug.color + style = 'dashed,rounded' } SubGraph MainSubGraphFileProxy -Attributes $ProxiesAttr -ScriptBlock { # Dummy Node used for subgraph centering - node DummyFileProxy @{Label=$DiagramDummyLabel; fontsize=18; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} - node DummyFileProxyToPG @{Label="DummyFileProxyToPG"; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} + Node DummyFileProxy @{Label = $DiagramDummyLabel; fontsize = 18; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } + Node DummyFileProxyToPG @{Label = "DummyFileProxyToPG"; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } if ($Dir -eq "TB") { - node FileLeft @{Label='FileLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node FileLeftt @{Label='FileLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node FileRight @{Label='FileRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge FileLeft,FileLeftt,DummyFileProxy,FileRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank FileLeft,FileLeftt,DummyFileProxy,FileRight + Node FileLeft @{Label = 'FileLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node FileLeftt @{Label = 'FileLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node FileRight @{Label = 'FileRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge FileLeft, FileLeftt, DummyFileProxy, FileRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank FileLeft, FileLeftt, DummyFileProxy, FileRight } foreach ($ProxyObj in $FileBackupProxy) { $PROXYHASHTABLE = @{} $ProxyObj.psobject.properties | ForEach-Object { $PROXYHASHTABLE[$_.Name] = $_.Value } - node $ProxyObj -NodeScript {$_.Name} @{Label=$PROXYHASHTABLE.Label; fontname="Segoe Ui"} - edge -From DummyFileProxy -To $ProxyObj.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} - edge -from $ProxyObj.Name -to DummyFileProxyToPG @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Node $ProxyObj -NodeScript { $_.Name } @{Label = $PROXYHASHTABLE.Label; fontname = "Segoe Ui" } + Edge -From DummyFileProxy -To $ProxyObj.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + Edge -From $ProxyObj.Name -To DummyFileProxyToPG @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } Rank $FileBackupProxy.Name } if ($Dir -eq 'LR') { - edge $BackupServerInfo.Name -to DummyFileProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyFileProxy @{minlen = 3; } } else { - edge $BackupServerInfo.Name -to DummyFileProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyFileProxy @{minlen = 3; } } } } - } - catch { + } catch { $_ } @@ -90,31 +89,31 @@ function Get-DiagBackupToProtectedGroup { } if ($ProtectedGroups) { - SubGraph MainSubGraph -Attributes @{Label=$DiagramLabel; fontsize=22; penwidth=1; labelloc='t'; style='dashed,rounded'; color=$SubGraphDebug.color} { + SubGraph MainSubGraph -Attributes @{Label = $DiagramLabel; fontsize = 22; penwidth = 1; labelloc = 't'; style = 'dashed,rounded'; color = $SubGraphDebug.color } { # Node used for subgraph centering - node ProtectedGroup @{Label=$DiagramDummyLabel; fontsize=22; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node ProtectedGroup @{Label = $DiagramDummyLabel; fontsize = 22; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq "TB") { - node DummyPGLeft @{Label='DummyPGLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node DummyPGLeftt @{Label='DummyPGLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node DummyPGRight @{Label='DummyPGRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge DummyPGLeft,DummyPGLeftt,ProtectedGroup,DummyPGRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank DummyPGLeft,DummyPGLeftt,ProtectedGroup,DummyPGRight + Node DummyPGLeft @{Label = 'DummyPGLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node DummyPGLeftt @{Label = 'DummyPGLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node DummyPGRight @{Label = 'DummyPGRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge DummyPGLeft, DummyPGLeftt, ProtectedGroup, DummyPGRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank DummyPGLeft, DummyPGLeftt, ProtectedGroup, DummyPGRight } if ($ADContainer) { - SubGraph ADContainer -Attributes @{Label=(Get-HTMLLabel -Label 'Active Directory Computers' -Type "VBR_AGENT_AD_Logo" -SubgraphLabel); fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph ADContainer -Attributes @{Label = (Get-HTMLLabel -Label 'Active Directory Computers' -Type "VBR_AGENT_AD_Logo" -SubgraphLabel); fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { # Node used for subgraph centering - node DummyADContainer @{Label='DummyADC'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'} + Node DummyADContainer @{Label = 'DummyADC'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if ($ADContainer.count -le 2) { foreach ($PGOBJ in ($ADContainer | Sort-Object -Property Name)) { $PGHASHTABLE = @{} - $PGOBJ.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $PGOBJ.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } $Ous = @() - $Status = Switch ($PGOBJ.Object.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + $Status = Switch ($PGOBJ.Object.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } $Ous += $PGOBJ.Object.Container.Entity | ForEach-Object { @@ -128,23 +127,22 @@ function Get-DiagBackupToProtectedGroup { Convert-TableToHTML -Label $PGOBJ.Name -Name $PGOBJ.Name -Row $Rows -HeaderColor "#005f4b" -HeaderFontColor "white" -BorderColor "black" -FontSize 14 - edge -from DummyADContainer -to $PGOBJ.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyADContainer -To $PGOBJ.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } - } - else { - $Group = Split-array -inArray ($ADContainer | Sort-Object -Property Name) -size 2 + } else { + $Group = Split-Array -inArray ($ADContainer | Sort-Object -Property Name) -size 2 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "ADGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "ADGroup$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $PGHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $_.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } - $Status = Switch ($_.Object.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + $Status = Switch ($_.Object.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } $Ous = @() @@ -163,31 +161,31 @@ function Get-DiagBackupToProtectedGroup { $Number++ } - edge -From DummyADContainer -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyADContainer -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $LocalPGNum = 1 while ($LocalPGNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $LocalPGNum++ } } } - edge -from ProtectedGroup -to DummyADContainer @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From ProtectedGroup -To DummyADContainer @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($ManualContainer) { - SubGraph MCContainer -Attributes @{Label=(Get-HTMLLabel -Label 'Manual Computers' -Type "VBR_AGENT_MC" -SubgraphLabel); fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph MCContainer -Attributes @{Label = (Get-HTMLLabel -Label 'Manual Computers' -Type "VBR_AGENT_MC" -SubgraphLabel); fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { # Node used for subgraph centering - node DummyMCContainer @{Label='DummyMC'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'} + Node DummyMCContainer @{Label = 'DummyMC'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if ($ManualContainer.count -le 2) { foreach ($PGOBJ in ($ManualContainer | Sort-Object -Property Name)) { $PGHASHTABLE = @{} - $PGOBJ.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $PGOBJ.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } - $Status = Switch ($PGOBJ.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + $Status = Switch ($PGOBJ.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } $Rows = @( @@ -196,24 +194,23 @@ function Get-DiagBackupToProtectedGroup { Convert-TableToHTML -Label $PGOBJ.Name -Name $PGOBJ.Name -Row $Rows -HeaderColor "#005f4b" -HeaderFontColor "white" -BorderColor "black" -FontSize 14 - edge -from DummyMCContainer -to $PGOBJ.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyMCContainer -To $PGOBJ.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } - } - else { - $Group = Split-array -inArray ($ManualContainer | Sort-Object -Property Name) -size 2 + } else { + $Group = Split-Array -inArray ($ManualContainer | Sort-Object -Property Name) -size 2 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "MCGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "MCGroup$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $PGHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $_.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } - $Status = Switch ($_.Object.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + $Status = Switch ($_.Object.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } $Rows = @( @@ -226,31 +223,31 @@ function Get-DiagBackupToProtectedGroup { $Number++ } - edge -From DummyMCContainer -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyMCContainer -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $LocalPGNum = 1 while ($LocalPGNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $LocalPGNum++ } } } - edge -from ProtectedGroup -to DummyMCContainer @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From ProtectedGroup -To DummyMCContainer @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($IndividualContainer) { - SubGraph ICContainer -Attributes @{Label=(Get-HTMLLabel -Label 'Individual Computers' -Type "VBR_AGENT_IC" -SubgraphLabel); fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph ICContainer -Attributes @{Label = (Get-HTMLLabel -Label 'Individual Computers' -Type "VBR_AGENT_IC" -SubgraphLabel); fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { # Node used for subgraph centering - node DummyICContainer @{Label='DummyIC'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'} + Node DummyICContainer @{Label = 'DummyIC'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if ($IndividualContainer.count -le 2) { foreach ($PGOBJ in ($IndividualContainer | Sort-Object -Property Name)) { $PGHASHTABLE = @{} - $PGOBJ.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $PGOBJ.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } - $Status = Switch ($PGOBJ.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + $Status = Switch ($PGOBJ.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } @@ -267,23 +264,22 @@ function Get-DiagBackupToProtectedGroup { Convert-TableToHTML -Label $PGOBJ.Name -Name $PGOBJ.Name -Row $Rows -HeaderColor "#005f4b" -HeaderFontColor "white" -BorderColor "black" -FontSize 14 - edge -from DummyICContainer -to $PGOBJ.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyICContainer -To $PGOBJ.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } - } - else { - $Group = Split-array -inArray ($IndividualContainer | Sort-Object -Property Name) -size 2 + } else { + $Group = Split-Array -inArray ($IndividualContainer | Sort-Object -Property Name) -size 2 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "ICGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "ICGroup$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $PGHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $_.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } - $Status = Switch ($_.Object.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + $Status = Switch ($_.Object.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } $Entities = @() @@ -304,48 +300,47 @@ function Get-DiagBackupToProtectedGroup { $Number++ } - edge -From DummyICContainer -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyICContainer -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $LocalPGNum = 1 while ($LocalPGNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $LocalPGNum++ } } } - edge -from ProtectedGroup -to DummyICContainer @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From ProtectedGroup -To DummyICContainer @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($CSVContainer) { - SubGraph CSVContainer -Attributes @{Label=(Get-HTMLLabel -Label 'CSV Computers' -Type "VBR_AGENT_CSV_Logo" -SubgraphLabel); fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph CSVContainer -Attributes @{Label = (Get-HTMLLabel -Label 'CSV Computers' -Type "VBR_AGENT_CSV_Logo" -SubgraphLabel); fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { # Node used for subgraph centering - node DummyCSVContainer @{Label='DummyCSVC'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'} + Node DummyCSVContainer @{Label = 'DummyCSVC'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if ($CSVContainer.count -le 2) { foreach ($PGOBJ in ($CSVContainer | Sort-Object -Property Name)) { $PGHASHTABLE = @{} - $PGOBJ.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $PGOBJ.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } $Rows = @( "Type: $($PGOBJ.Object.Type) Status: $($Status) Schedule: $($PGOBJ.Object.ScheduleOptions.PolicyType)" "Distribution Server : $($PGOBJ.Object.DeploymentOptions.DistributionServer.Name)" "CSV File : $($PGOBJ.Object.Container.Path)" "Credential : $($PGOBJ.Object.Container.MasterCredentials.Name)" - ) + ) Convert-TableToHTML -Label $PGOBJ.Name -Name $PGOBJ.Name -Row $Rows -HeaderColor "#005f4b" -HeaderFontColor "white" -BorderColor "black" -FontSize 14 - edge -from DummyCSVContainer -to $PGOBJ.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyCSVContainer -To $PGOBJ.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } - } - else { - $Group = Split-array -inArray ($CSVContainer | Sort-Object -Property Name) -size 2 + } else { + $Group = Split-Array -inArray ($CSVContainer | Sort-Object -Property Name) -size 2 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "CSVGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "CSVGroup$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $PGHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$PGHASHTABLE[$_.Name] = $_.Value } + $_.psobject.properties | ForEach-Object { $PGHASHTABLE[$_.Name] = $_.Value } $Rows = @( "Type: $($_.Object.Type) Status: $($Status) Schedule: $($_.Object.ScheduleOptions.PolicyType)" "Distribution Server : $($_.Object.DeploymentOptions.DistributionServer.Name)" @@ -359,25 +354,24 @@ function Get-DiagBackupToProtectedGroup { $Number++ } - edge -From DummyCSVContainer -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummyCSVContainer -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $LocalPGNum = 1 while ($LocalPGNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$LocalPGNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $LocalPGNum++ } } } - edge -from ProtectedGroup -to DummyCSVContainer @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From ProtectedGroup -To DummyCSVContainer @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } } - edge -from DummyFileProxyToPG -to ProtectedGroup @{minlen=3} + Edge -From DummyFileProxyToPG -To ProtectedGroup @{minlen = 3 } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToRepo.ps1 b/Src/Private/Get-DiagBackupToRepo.ps1 index 9cf17ab..53e41d3 100644 --- a/Src/Private/Get-DiagBackupToRepo.ps1 +++ b/Src/Private/Get-DiagBackupToRepo.ps1 @@ -22,8 +22,8 @@ function Get-DiagBackupToRepo { try { $BackupRepo = Get-VbrBackupRepoInfo - $LocalBackupRepo = Get-VbrBackupRepoInfo | Where-Object {$_.Role -like '*Local'} - $RemoteBackupRepo = Get-VbrBackupRepoInfo | Where-Object {$_.Role -like 'Dedup*'} + $LocalBackupRepo = Get-VbrBackupRepoInfo | Where-Object { $_.Role -like '*Local' } + $RemoteBackupRepo = Get-VbrBackupRepoInfo | Where-Object { $_.Role -like 'Dedup*' } $ObjStorage = Get-VbrBackupObjectRepoInfo $ArchiveObjStorage = Get-VbrBackupArchObjRepoInfo @@ -37,182 +37,177 @@ function Get-DiagBackupToRepo { } if ($BackupRepo) { - SubGraph MainSubGraph -Attributes @{Label=$DiagramLabel; fontsize=22; penwidth=1; labelloc='t'; style='dashed,rounded'; color=$SubGraphDebug.color} { + SubGraph MainSubGraph -Attributes @{Label = $DiagramLabel; fontsize = 22; penwidth = 1; labelloc = 't'; style = 'dashed,rounded'; color = $SubGraphDebug.color } { # Node used for subgraph centering - node BackupRepository @{Label=$DiagramDummyLabel; fontsize=22; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node BackupRepository @{Label = $DiagramDummyLabel; fontsize = 22; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq "TB") { - node RepoLeft @{Label='RepoLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node RepoLeftt @{Label='RepoLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node RepoRight @{Label='RepoRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge RepoLeft,RepoLeftt,BackupRepository,RepoRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank RepoLeft,RepoLeftt,BackupRepository,RepoRight + Node RepoLeft @{Label = 'RepoLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node RepoLeftt @{Label = 'RepoLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node RepoRight @{Label = 'RepoRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge RepoLeft, RepoLeftt, BackupRepository, RepoRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank RepoLeft, RepoLeftt, BackupRepository, RepoRight } if ($LocalBackupRepo) { - SubGraph LocalRepos -Attributes @{Label='Local Repository'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph LocalRepos -Attributes @{Label = 'Local Repository'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { # Node used for subgraph centering - node LocalReposDummy @{Label='LocalReposDummy'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'} + Node LocalReposDummy @{Label = 'LocalReposDummy'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if ($LocalBackupRepo.count -le 3) { foreach ($REPOOBJ in ($LocalBackupRepo | Sort-Object -Property Name)) { $REPOHASHTABLE = @{} - $REPOOBJ.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value } - node $REPOOBJ -NodeScript {$_.Name} @{Label=$REPOHASHTABLE.Label; fontname="Segoe Ui"} + $REPOOBJ.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } + Node $REPOOBJ -NodeScript { $_.Name } @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } - edge -from LocalReposDummy -to $LocalBackupRepo.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} - } - else { - $Group = Split-array -inArray ($LocalBackupRepo | Sort-Object -Property Name) -size 3 + Edge -From LocalReposDummy -To $LocalBackupRepo.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + } else { + $Group = Split-Array -inArray ($LocalBackupRepo | Sort-Object -Property Name) -size 3 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "LocalBackupGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "LocalBackupGroup$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $REPOHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value } - node $_.Name @{Label=$REPOHASHTABLE.Label; fontname="Segoe Ui"} + $_.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } + Node $_.Name @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } } $Number++ } - edge -From LocalReposDummy -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From LocalReposDummy -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $LocalRepoNum = 1 while ($LocalRepoNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$LocalRepoNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$LocalRepoNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $LocalRepoNum++ } } } - edge -from BackupRepository -to LocalReposDummy @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From BackupRepository -To LocalReposDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($RemoteBackupRepo) { - SubGraph RemoteRepos -Attributes @{Label='Deduplicating Storage Appliances'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { - node RemoteReposDummy @{Label='RemoteReposDummy'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'} + SubGraph RemoteRepos -Attributes @{Label = 'Deduplicating Storage Appliances'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + Node RemoteReposDummy @{Label = 'RemoteReposDummy'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain' } if ($RemoteBackupRepo.count -le 3) { foreach ($REPOOBJ in ($RemoteBackupRepo | Sort-Object -Property Name)) { $REPOHASHTABLE = @{} $REPOOBJ.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } - node $REPOOBJ -NodeScript {$_.Name} @{Label=$REPOHASHTABLE.Label; fontname="Segoe Ui"} + Node $REPOOBJ -NodeScript { $_.Name } @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } - edge -from RemoteReposDummy -to $RemoteBackupRepo.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} - } - else { - $Group = Split-array -inArray ($RemoteBackupRepo| Sort-Object -Property Name) -size 3 + Edge -From RemoteReposDummy -To $RemoteBackupRepo.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + } else { + $Group = Split-Array -inArray ($RemoteBackupRepo | Sort-Object -Property Name) -size 3 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "RemoteBackupRepo$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "RemoteBackupRepo$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $REPOHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value } - node $_.Name @{Label=$REPOHASHTABLE.Label; fontname="Segoe Ui"} + $_.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } + Node $_.Name @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } } $Number++ } - edge -From RemoteReposDummy -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From RemoteReposDummy -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $RemoteRepoNum = 1 while ($RemoteRepoNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$RemoteRepoNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$RemoteRepoNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $RemoteRepoNum++ } } } - edge -from BackupRepository -to RemoteReposDummy @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From BackupRepository -To RemoteReposDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($ObjStorage) { - SubGraph ObjectStorage -Attributes @{Label='Object Repository'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { - node ObjectStorageDummy @{Label='ObjectStorageDummy'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'} + SubGraph ObjectStorage -Attributes @{Label = 'Object Repository'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + Node ObjectStorageDummy @{Label = 'ObjectStorageDummy'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if ($ObjStorage.count -le 3) { foreach ($STORAGEOBJ in ($ObjStorage | Sort-Object -Property Name)) { $OBJHASHTABLE = @{} $STORAGEOBJ.psobject.properties | ForEach-Object { $OBJHASHTABLE[$_.Name] = $_.Value } - node $STORAGEOBJ -NodeScript {$_.Name} @{Label=$OBJHASHTABLE.Label; fontname="Segoe Ui"} + Node $STORAGEOBJ -NodeScript { $_.Name } @{Label = $OBJHASHTABLE.Label; fontname = "Segoe Ui" } } - edge -from ObjectStorageDummy -to $ObjStorage.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} - } - else { - $Group = Split-array -inArray ($ObjStorage| Sort-Object -Property Name) -size 3 + Edge -From ObjectStorageDummy -To $ObjStorage.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + } else { + $Group = Split-Array -inArray ($ObjStorage | Sort-Object -Property Name) -size 3 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "ObjectStorage$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "ObjectStorage$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $REPOHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value } - node $_.Name @{Label=$REPOHASHTABLE.Label; fontname="Segoe Ui"} + $_.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } + Node $_.Name @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } } $Number++ } - edge -From ObjectStorageDummy -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From ObjectStorageDummy -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $ObjectStorageNum = 1 while ($ObjectStorageNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$ObjectStorageNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$ObjectStorageNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $ObjectStorageNum++ } } } - edge -from BackupRepository -to ObjectStorageDummy @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From BackupRepository -To ObjectStorageDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($ArchiveObjStorage) { - SubGraph ArchiveObjectStorage -Attributes @{Label='Archive Object Repository'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { - node ArchiveObjectStorageDummy @{Label='ArchiveObjectStorageDummy'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'} + SubGraph ArchiveObjectStorage -Attributes @{Label = 'Archive Object Repository'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + Node ArchiveObjectStorageDummy @{Label = 'ArchiveObjectStorageDummy'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain' } if ($ArchiveObjStorage.count -le 3) { foreach ($STORAGEArchiveOBJ in ($ArchiveObjStorage | Sort-Object -Property Name)) { $ARCHOBJHASHTABLE = @{} $STORAGEArchiveOBJ.psobject.properties | ForEach-Object { $ARCHOBJHASHTABLE[$_.Name] = $_.Value } - node $STORAGEArchiveOBJ -NodeScript {$_.Name} @{Label=$ARCHOBJHASHTABLE.Label; fontname="Segoe Ui"} + Node $STORAGEArchiveOBJ -NodeScript { $_.Name } @{Label = $ARCHOBJHASHTABLE.Label; fontname = "Segoe Ui" } } - edge -from ArchiveObjectStorageDummy -to $ArchiveObjStorage.Name @{constraint="true";minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} - } - else { - $Group = Split-array -inArray ($ArchiveObjStorage| Sort-Object -Property Name) -size 3 + Edge -From ArchiveObjectStorageDummy -To $ArchiveObjStorage.Name @{constraint = "true"; minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + } else { + $Group = Split-Array -inArray ($ArchiveObjStorage | Sort-Object -Property Name) -size 3 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "ArchiveObjectStorage$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "ArchiveObjectStorage$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $REPOHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value } - node $_.Name @{Label=$REPOHASHTABLE.Label; fontname="Segoe Ui"} + $_.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } + Node $_.Name @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } } $Number++ } - edge -From ArchiveObjectStorageDummy -To $Group[0].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From ArchiveObjectStorageDummy -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $ArchiveObjectStorageNum = 1 while ($ArchiveObjectStorageNum -ne $Group.Length) { - edge -From $Group[$Start].Name -To $Group[$ArchiveObjectStorageNum].Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Name -To $Group[$ArchiveObjectStorageNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $ArchiveObjectStorageNum++ } } } - edge -from BackupRepository -to ArchiveObjectStorageDummy @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From BackupRepository -To ArchiveObjectStorageDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } } - edge -from $BackupServerInfo.Name -to BackupRepository @{minlen=3} + Edge -From $BackupServerInfo.Name -To BackupRepository @{minlen = 3 } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToSobr.ps1 b/Src/Private/Get-DiagBackupToSobr.ps1 index 60daa18..f86b54f 100644 --- a/Src/Private/Get-DiagBackupToSobr.ps1 +++ b/Src/Private/Get-DiagBackupToSobr.ps1 @@ -32,55 +32,54 @@ function Get-DiagBackupToSobr { $DiagramDummyLabel = 'SOBR Repository' } if ($SobrRepo) { - SubGraph MainSubGraph -Attributes @{Label=$DiagramLabel ; fontsize=22; penwidth=1.5; labelloc='t'; style='dashed,rounded'; color=$SubGraphDebug.color} { + SubGraph MainSubGraph -Attributes @{Label = $DiagramLabel ; fontsize = 22; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded'; color = $SubGraphDebug.color } { # Dummy Node used for subgraph centering - node DummySOBREPO @{Label=$DiagramDummyLabel; fontsize=22; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node DummySOBREPO @{Label = $DiagramDummyLabel; fontsize = 22; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq 'TB') { - node SobrRepoLeft @{Label='SobrRepoLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node SobrRepoLeftt @{Label='SobrRepoLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node SobrRepoRight @{Label='SobrRepoRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge SobrRepoLeft,SobrRepoLeftt,DummySOBREPO,SobrRepoRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank SobrRepoLeft,SobrRepoLeftt,DummySOBREPO,SobrRepoRight + Node SobrRepoLeft @{Label = 'SobrRepoLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node SobrRepoLeftt @{Label = 'SobrRepoLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node SobrRepoRight @{Label = 'SobrRepoRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge SobrRepoLeft, SobrRepoLeftt, DummySOBREPO, SobrRepoRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank SobrRepoLeft, SobrRepoLeftt, DummySOBREPO, SobrRepoRight } foreach ($SOBROBJ in $SobrRepo) { $SubGraphName = Remove-SpecialChar -String $SOBROBJ.Name -SpecialChars '\- ' - SubGraph $SubGraphName -Attributes @{Label=$SOBROBJ.Name; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph $SubGraphName -Attributes @{Label = $SOBROBJ.Name; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { $SOBRHASHTABLE = @{} $SOBROBJ.psobject.properties | ForEach-Object { $SOBRHASHTABLE[$_.Name] = $_.Value } - node $SOBROBJ -NodeScript {$_.Name} @{Label=$SOBRHASHTABLE.Label; fontname="Segoe Ui"; shape="plain";} + Node $SOBROBJ -NodeScript { $_.Name } @{Label = $SOBRHASHTABLE.Label; fontname = "Segoe Ui"; shape = "plain"; } if ($SOBROBJ.Performance) { - SubGraph "$($SubGraphName)Performance" -Attributes @{Label="Performance Extent"; fontsize=18; penwidth=1.5; labelloc='b'; style="dashed,rounded";} { + SubGraph "$($SubGraphName)Performance" -Attributes @{Label = "Performance Extent"; fontsize = 18; penwidth = 1.5; labelloc = 'b'; style = "dashed,rounded"; } { - $SOBROBJ.Performance | ForEach-Object {node $_.Name @{Label=Get-NodeIcon -Name $_.Name -Type $_.Icon -Align "Center" -Rows $_.Rows; fontname="Segoe Ui"; shape="plain"}} + $SOBROBJ.Performance | ForEach-Object { Node $_.Name @{Label = Get-NodeIcon -Name $_.Name -Type $_.Icon -Align "Center" -Rows $_.Rows; fontname = "Segoe Ui"; shape = "plain" } } } } if ($SOBROBJ.Capacity) { - SubGraph "$($SubGraphName)Capacity" -Attributes @{Label="Capacity Extent"; fontsize=18; penwidth=1.5; labelloc='b'; style="dashed,rounded"} { + SubGraph "$($SubGraphName)Capacity" -Attributes @{Label = "Capacity Extent"; fontsize = 18; penwidth = 1.5; labelloc = 'b'; style = "dashed,rounded" } { - $SOBROBJ.Capacity | ForEach-Object {node $_.Name @{Label=Get-NodeIcon -Name $_.Name -Type $_.Icon -Align "Center" -Rows $_.Rows; fontname="Segoe Ui"; shape="plain"}} + $SOBROBJ.Capacity | ForEach-Object { Node $_.Name @{Label = Get-NodeIcon -Name $_.Name -Type $_.Icon -Align "Center" -Rows $_.Rows; fontname = "Segoe Ui"; shape = "plain" } } } } if ($SOBROBJ.Archive) { - SubGraph "$($SubGraphName)Archive" -Attributes @{Label="Archive Extent"; fontsize=18; penwidth=1.5; labelloc='b'; style="dashed,rounded"} { + SubGraph "$($SubGraphName)Archive" -Attributes @{Label = "Archive Extent"; fontsize = 18; penwidth = 1.5; labelloc = 'b'; style = "dashed,rounded" } { - $SOBROBJ.Archive | ForEach-Object {node $_.Name @{Label=Get-NodeIcon -Name $_.Name -Type $_.Icon -Align "Center" -Rows $_.Rows; fontname="Segoe Ui"; shape="plain"}} + $SOBROBJ.Archive | ForEach-Object { Node $_.Name @{Label = Get-NodeIcon -Name $_.Name -Type $_.Icon -Align "Center" -Rows $_.Rows; fontname = "Segoe Ui"; shape = "plain" } } } } if ($SOBROBJ.Archive) { - $SOBROBJ.Performance | ForEach-Object {edge -from $SOBROBJ.Name -to $SOBROBJ.Archive.Name,$SOBROBJ.Capacity.Name,$_.Name @{minlen=2}} | Select-Object -Unique + $SOBROBJ.Performance | ForEach-Object { Edge -From $SOBROBJ.Name -To $SOBROBJ.Archive.Name, $SOBROBJ.Capacity.Name, $_.Name @{minlen = 2 } } | Select-Object -Unique - } else {$SOBROBJ.Performance | ForEach-Object {edge -from $SOBROBJ.Name -to $SOBROBJ.Capacity.Name,$_.Name @{minlen=2}} | Select-Object -Unique} + } else { $SOBROBJ.Performance | ForEach-Object { Edge -From $SOBROBJ.Name -To $SOBROBJ.Capacity.Name, $_.Name @{minlen = 2 } } | Select-Object -Unique } } - edge -From DummySOBREPO -To $SOBROBJ.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From DummySOBREPO -To $SOBROBJ.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } } - edge -from $BackupServerInfo.Name -to DummySOBREPO @{minlen=3} + Edge -From $BackupServerInfo.Name -To DummySOBREPO @{minlen = 3 } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToTape.ps1 b/Src/Private/Get-DiagBackupToTape.ps1 index c75dfa6..36bd4b9 100644 --- a/Src/Private/Get-DiagBackupToTape.ps1 +++ b/Src/Private/Get-DiagBackupToTape.ps1 @@ -34,63 +34,62 @@ function Get-DiagBackupToTape { $DiagramDummyLabel = 'Tape Servers' } if ($BackupTapeServers) { - SubGraph MainSubGraph -Attributes @{Label=$DiagramLabel; fontsize=22; penwidth=1; labelloc='t'; style='dashed,rounded'; color=$SubGraphDebug.color} { + SubGraph MainSubGraph -Attributes @{Label = $DiagramLabel; fontsize = 22; penwidth = 1; labelloc = 't'; style = 'dashed,rounded'; color = $SubGraphDebug.color } { if ($BackupTapeServers) { # Node used for subgraph centering - node TapeServersLabel @{Label=$DiagramDummyLabel; fontsize=22; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node TapeServersLabel @{Label = $DiagramDummyLabel; fontsize = 22; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq "TB") { - node TapeLeft @{Label='TapeLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node TapeLeftt @{Label='TapeLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node TapeRight @{Label='TapeRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge TapeLeft,TapeLeftt,TapeServersLabel,TapeRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank TapeLeft,TapeLeftt,TapeServersLabel,TapeRight + Node TapeLeft @{Label = 'TapeLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node TapeLeftt @{Label = 'TapeLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node TapeRight @{Label = 'TapeRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge TapeLeft, TapeLeftt, TapeServersLabel, TapeRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank TapeLeft, TapeLeftt, TapeServersLabel, TapeRight } - SubGraph TapeServers -Attributes @{Label=' '; fontsize=18; penwidth=1.5; labelloc='t'; style=$SubGraphDebug.style; color=$SubGraphDebug.color} { + SubGraph TapeServers -Attributes @{Label = ' '; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = $SubGraphDebug.style; color = $SubGraphDebug.color } { # Node used for subgraph centering - node TapeServerDummy @{Label=$DiagramDummyLabel; shape='plain'; style=$EdgeDebug.style; color=$EdgeDebug.color} + Node TapeServerDummy @{Label = $DiagramDummyLabel; shape = 'plain'; style = $EdgeDebug.style; color = $EdgeDebug.color } foreach ($TSOBJ in ($BackupTapeServers | Sort-Object -Property Name)) { $TSSubGraph = Remove-SpecialChar -String $TSOBJ.id -SpecialChars '\-' - SubGraph $TSSubGraph -Attributes @{Label=' '; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph $TSSubGraph -Attributes @{Label = ' '; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { $TSHASHTABLE = @{} - $TSOBJ.psobject.properties | ForEach-Object {$TSHASHTABLE[$_.Name] = $_.Value } - node $TSOBJ -NodeScript {$_.Name} @{Label=$TSHASHTABLE.Label; fontname="Segoe Ui"} + $TSOBJ.psobject.properties | ForEach-Object { $TSHASHTABLE[$_.Name] = $_.Value } + Node $TSOBJ -NodeScript { $_.Name } @{Label = $TSHASHTABLE.Label; fontname = "Segoe Ui" } if ($BackupTapeLibrary) { - $BKPTLOBJ = ($BackupTapeLibrary | Where-Object {$_.TapeServerId -eq $TSOBJ.Id} | Sort-Object -Property Name) + $BKPTLOBJ = ($BackupTapeLibrary | Where-Object { $_.TapeServerId -eq $TSOBJ.Id } | Sort-Object -Property Name) foreach ($TSLibraryOBJ in $BKPTLOBJ) { $TLSubGraph = Remove-SpecialChar -String $TSLibraryOBJ.id -SpecialChars '\-' - SubGraph $TLSubGraph -Attributes @{Label=' '; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} { + SubGraph $TLSubGraph -Attributes @{Label = ' '; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { $TSLHASHTABLE = @{} - $TSLibraryOBJ.psobject.properties | ForEach-Object {$TSLHASHTABLE[$_.Name] = $_.Value } - node $TSLibraryOBJ -NodeScript {$_.Id} @{Label=$TSLHASHTABLE.Label; fontname="Segoe Ui"} + $TSLibraryOBJ.psobject.properties | ForEach-Object { $TSLHASHTABLE[$_.Name] = $_.Value } + Node $TSLibraryOBJ -NodeScript { $_.Id } @{Label = $TSLHASHTABLE.Label; fontname = "Segoe Ui" } if ($BackupTapeDrives) { - $TapeLibraryDrives = ($BackupTapeDrives | Where-Object {$_.LibraryId -eq $TSLibraryOBJ.Id} | Sort-Object -Property Name) + $TapeLibraryDrives = ($BackupTapeDrives | Where-Object { $_.LibraryId -eq $TSLibraryOBJ.Id } | Sort-Object -Property Name) if ($TapeLibraryDrives.count -le 3) { foreach ($TSDriveOBJ in $TapeLibraryDrives) { $TSDHASHTABLE = @{} - $TSDriveOBJ.psobject.properties | ForEach-Object {$TSDHASHTABLE[$_.Name] = $_.Value } - node $TSDriveOBJ -NodeScript {$_.Id} @{Label=$TSDHASHTABLE.Label; fontname="Segoe Ui"} - $TSDriveOBJ | foreach-object { edge -from $TSLibraryOBJ.id -to $_.id } + $TSDriveOBJ.psobject.properties | ForEach-Object { $TSDHASHTABLE[$_.Name] = $_.Value } + Node $TSDriveOBJ -NodeScript { $_.Id } @{Label = $TSDHASHTABLE.Label; fontname = "Segoe Ui" } + $TSDriveOBJ | ForEach-Object { Edge -From $TSLibraryOBJ.id -To $_.id } } - } - else { - $Group = Split-array -inArray $TapeLibraryDrives -size 3 + } else { + $Group = Split-Array -inArray $TapeLibraryDrives -size 3 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "TDGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} { + SubGraph "TDGroup$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { $Group[$Number] | ForEach-Object { $TSDHASHTABLE = @{} - $_.psobject.properties | ForEach-Object {$TSDHASHTABLE[$_.Name] = $_.Value } - node $_.Id @{Label=$TSDHASHTABLE.Label; fontname="Segoe Ui"} + $_.psobject.properties | ForEach-Object { $TSDHASHTABLE[$_.Name] = $_.Value } + Node $_.Id @{Label = $TSDHASHTABLE.Label; fontname = "Segoe Ui" } } } $Number++ } - edge -From $TSLibraryOBJ.id -To $Group[0].Id @{style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $TSLibraryOBJ.id -To $Group[0].Id @{style = $EdgeDebug.style; color = $EdgeDebug.color } $Start = 0 $TSNum = 1 while ($TSNum -ne $Group.Length) { - edge -From $Group[$Start].Id -To $Group[$TSNum].Id @{style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From $Group[$Start].Id -To $Group[$TSNum].Id @{style = $EdgeDebug.style; color = $EdgeDebug.color } $Start++ $TSNum++ } @@ -98,20 +97,19 @@ function Get-DiagBackupToTape { } } } - $BKPTLOBJ | ForEach-Object {edge -from $TSOBJ.Name -to $_.id} + $BKPTLOBJ | ForEach-Object { Edge -From $TSOBJ.Name -To $_.id } } } } - ($BackupTapeServers | Sort-Object -Property Name) | ForEach-Object { edge -from TapeServerDummy -to $_.Name @{style=$EdgeDebug.style; color=$EdgeDebug.color}} + ($BackupTapeServers | Sort-Object -Property Name) | ForEach-Object { Edge -From TapeServerDummy -To $_.Name @{style = $EdgeDebug.style; color = $EdgeDebug.color } } } - edge -from TapeServersLabel -to TapeServerDummy @{style=$EdgeDebug.style; color=$EdgeDebug.color} + Edge -From TapeServersLabel -To TapeServerDummy @{style = $EdgeDebug.style; color = $EdgeDebug.color } } } - edge -from $BackupServerInfo.Name -to TapeServersLabel @{minlen=2} + Edge -From $BackupServerInfo.Name -To TapeServersLabel @{minlen = 2 } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToViProxy.ps1 b/Src/Private/Get-DiagBackupToViProxy.ps1 index ad452f2..bc605f4 100644 --- a/Src/Private/Get-DiagBackupToViProxy.ps1 +++ b/Src/Private/Get-DiagBackupToViProxy.ps1 @@ -35,32 +35,32 @@ function Get-DiagBackupToViProxy { fontsize = 18 penwidth = 1.5 labelloc = 't' - color=$SubGraphDebug.color - style='dashed,rounded' + color = $SubGraphDebug.color + style = 'dashed,rounded' } SubGraph MainSubGraph -Attributes $ProxiesAttr -ScriptBlock { # Dummy Node used for subgraph centering - node DummyVMwareProxy @{Label=$DiagramDummyLabel; fontsize=18; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node DummyVMwareProxy @{Label = $DiagramDummyLabel; fontsize = 18; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } if ($Dir -eq "TB") { - node ViLeft @{Label='ViLeft'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node ViLeftt @{Label='ViLeftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node ViRight @{Label='ViRight'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - edge ViLeft,ViLeftt,DummyVMwareProxy,ViRight @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank ViLeft,ViLeftt,DummyVMwareProxy,ViRight + Node ViLeft @{Label = 'ViLeft'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node ViLeftt @{Label = 'ViLeftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node ViRight @{Label = 'ViRight'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Edge ViLeft, ViLeftt, DummyVMwareProxy, ViRight @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank ViLeft, ViLeftt, DummyVMwareProxy, ViRight } foreach ($ProxyObj in $VMwareBackupProxy) { $PROXYHASHTABLE = @{} $ProxyObj.psobject.properties | ForEach-Object { $PROXYHASHTABLE[$_.Name] = $_.Value } - node $ProxyObj -NodeScript {$_.Name} @{Label=$PROXYHASHTABLE.Label; fontname="Segoe Ui"} - edge -From DummyVMwareProxy -To $ProxyObj.Name @{constraint="true"; minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Node $ProxyObj -NodeScript { $_.Name } @{Label = $PROXYHASHTABLE.Label; fontname = "Segoe Ui" } + Edge -From DummyVMwareProxy -To $ProxyObj.Name @{constraint = "true"; minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } Rank $VMwareBackupProxy.Name } if ($Dir -eq 'LR') { - edge $BackupServerInfo.Name -to DummyVMwareProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyVMwareProxy @{minlen = 3; } } else { - edge $BackupServerInfo.Name -to DummyVMwareProxy @{minlen=3;} + Edge $BackupServerInfo.Name -To DummyVMwareProxy @{minlen = 3; } } # $VirtObjs = Get-VBRServer | Where-Object {$_.Type -eq 'VC'} # $EsxiObjs = Get-VBRServer | Where-Object {$_.Type -eq 'Esxi' -and $_.IsStandaloneEsx() -eq 'True'} @@ -186,8 +186,7 @@ function Get-DiagBackupToViProxy { # edge -from DummyBackupProxy -to VMwareProxyMain @{style=$EdgeDebug.style; color=$EdgeDebug.color} # } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-DiagBackupToWanAccel.ps1 b/Src/Private/Get-DiagBackupToWanAccel.ps1 index a3c8ada..211f4b4 100644 --- a/Src/Private/Get-DiagBackupToWanAccel.ps1 +++ b/Src/Private/Get-DiagBackupToWanAccel.ps1 @@ -38,29 +38,28 @@ function Get-DiagBackupToWanAccel { fontsize = 18 penwidth = 1.5 labelloc = 't' - color=$SubGraphDebug.color - style='dashed,rounded' + color = $SubGraphDebug.color + style = 'dashed,rounded' } SubGraph MainSubGraph -Attributes $WANAccelAttr -ScriptBlock { # Dummy Node used for subgraph centering - node WANACCELSERVER @{Label=$DiagramDummyLabel; fontsize=18; fontname="Segoe Ui Black"; fontcolor='#005f4b'; shape='plain'} + Node WANACCELSERVER @{Label = $DiagramDummyLabel; fontsize = 18; fontname = "Segoe Ui Black"; fontcolor = '#005f4b'; shape = 'plain' } foreach ($WANOBJ in $WanAccel) { $WANHASHTABLE = @{} $WANOBJ.psobject.properties | ForEach-Object { $WANHASHTABLE[$_.Name] = $_.Value } - node $WANOBJ -NodeScript {$_.Name} @{Label=$WANHASHTABLE.Label; fontname="Segoe Ui"} - edge -From WANACCELSERVER -To $WANOBJ.Name @{constraint="true"; minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color} + Node $WANOBJ -NodeScript { $_.Name } @{Label = $WANHASHTABLE.Label; fontname = "Segoe Ui" } + Edge -From WANACCELSERVER -To $WANOBJ.Name @{constraint = "true"; minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } Rank $WanAccel.Name } if ($Dir -eq 'LR') { - edge $BackupServerInfo.Name -to WANACCELSERVER @{minlen=3; xlabel=($WanAccel.TrafficPort[0])} + Edge $BackupServerInfo.Name -To WANACCELSERVER @{minlen = 3; xlabel = ($WanAccel.TrafficPort[0]) } } else { - edge $BackupServerInfo.Name -to WANACCELSERVER @{minlen=3; xlabel=($WanAccel.TrafficPort[0])} + Edge $BackupServerInfo.Name -To WANACCELSERVER @{minlen = 3; xlabel = ($WanAccel.TrafficPort[0]) } } } } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-HtmlLabel.ps1 b/Src/Private/Get-HtmlLabel.ps1 index 312188d..578930c 100644 --- a/Src/Private/Get-HtmlLabel.ps1 +++ b/Src/Private/Get-HtmlLabel.ps1 @@ -9,10 +9,9 @@ Function Get-HTMLLabel { $ICON = 'NoIcon' } elseif ($URLIcon) { $ICON = 'NoIcon' - } - elseif ($images[$Type]) { + } elseif ($images[$Type]) { $ICON = $images[$Type] - } else {$ICON = "no_icon.png"} + } else { $ICON = "no_icon.png" } if (-Not $SubgraphLabel) { if ($ICON -ne 'NoIcon') { @@ -24,7 +23,7 @@ Function Get-HTMLLabel { $Label " - } else { + } else { return " diff --git a/Src/Private/Get-HtmlTable.ps1 b/Src/Private/Get-HtmlTable.ps1 index f163b9e..aba553e 100644 --- a/Src/Private/Get-HtmlTable.ps1 +++ b/Src/Private/Get-HtmlTable.ps1 @@ -2,15 +2,15 @@ Function Get-HTMLTable { param( [string[]] $Rows, [string] $Align = 'center', - [int] $TableBorder= 1, - [int] $CellBorder= 1, + [int] $TableBorder = 1, + [int] $CellBorder = 1, [int] $FontSize = 14, [string] $Logo ) if ($images[$Logo]) { $ICON = $images[$Logo] - } else {$ICON = $false} + } else { $ICON = $false } $TR = '' foreach ($r in $Rows) { diff --git a/Src/Private/Get-NodeIcon.ps1 b/Src/Private/Get-NodeIcon.ps1 index 12f084e..952119e 100644 --- a/Src/Private/Get-NodeIcon.ps1 +++ b/Src/Private/Get-NodeIcon.ps1 @@ -17,25 +17,23 @@ Function Get-NodeIcon { $ICON = 'NoIcon' } elseif ($images[$Type]) { $ICON = $images[$Type] - } else {$ICON = "no_icon.png"} + } else { $ICON = "no_icon.png" } $TR = @() foreach ($r in $Rows) { - $TR += $r.getEnumerator() | ForEach-Object {""} + $TR += $r.getEnumerator() | ForEach-Object { "" } } if ($ICON -ne 'NoIcon') { if ($Align -eq "Center") { "
Veeam Logo
$($_.Key): $($_.Value)
$($_.Key): $($_.Value)
$TR
$Name
" - } - else { + } else { " $TR
$Name
" } } else { if ($Align -eq "Center") { "$TR
$Name
" - } - else { + } else { " $TR
$Name
" } } diff --git a/Src/Private/Get-VbrBackupArchObjRepoInfo.ps1 b/Src/Private/Get-VbrBackupArchObjRepoInfo.ps1 index a160dfd..4163a9f 100644 --- a/Src/Private/Get-VbrBackupArchObjRepoInfo.ps1 +++ b/Src/Private/Get-VbrBackupArchObjRepoInfo.ps1 @@ -29,33 +29,32 @@ function Get-VbrBackupArchObjRepoInfo { if ($ArchObjStorage.AmazonS3Folder) { $Folder = $ArchObjStorage.AmazonS3Folder - } - elseif ($ArchObjStorage.AzureBlobFolder) { + } elseif ($ArchObjStorage.AzureBlobFolder) { $Folder = $ArchObjStorage.AzureBlobFolder.Name $Container = $ArchObjStorage.AzureBlobFolder.Container - } else {$Folder = 'Unknown'} + } else { $Folder = 'Unknown' } $Rows = @{ Type = $ArchObjStorage.ArchiveType Folder = $Folder - Gateway = &{ + Gateway = & { if (-Not $ArchObjStorage.UseGatewayServer) { Switch ($ArchObjStorage.GatewayMode) { 'Gateway' { switch ($ArchObjStorage.GatewayServer.count) { - 0 {"Disable"} - 1 {$ArchObjStorage.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $ArchObjStorage.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } - 'Direct' {'Direct'} - default {'Unknown'} + 'Direct' { 'Direct' } + default { 'Unknown' } } } else { switch ($ArchObjStorage.GatewayServer.count) { - 0 {"Disable"} - 1 {$ArchObjStorage.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $ArchObjStorage.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } } @@ -74,8 +73,7 @@ function Get-VbrBackupArchObjRepoInfo { } return $ArchObjStorageInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupObjectRepoInfo.ps1 b/Src/Private/Get-VbrBackupObjectRepoInfo.ps1 index e0b159f..7c7b3a2 100644 --- a/Src/Private/Get-VbrBackupObjectRepoInfo.ps1 +++ b/Src/Private/Get-VbrBackupObjectRepoInfo.ps1 @@ -29,32 +29,31 @@ function Get-VbrBackupObjectRepoInfo { if ($ObjStorage.AmazonS3Folder) { $Folder = $ObjStorage.AmazonS3Folder - } - elseif ($ObjStorage.AzureBlobFolder) { + } elseif ($ObjStorage.AzureBlobFolder) { $Folder = $ObjStorage.AzureBlobFolder - } else {$Folder = 'Unknown'} + } else { $Folder = 'Unknown' } $Rows = @{ Type = $ObjStorage.Type Folder = $Folder - Gateway = &{ + Gateway = & { if (-Not $ObjStorage.UseGatewayServer) { Switch ($ObjStorage.ConnectionType) { 'Gateway' { switch ($ObjStorage.GatewayServer.count) { - 0 {"Disable"} - 1 {$ObjStorage.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $ObjStorage.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } - 'Direct' {'Direct'} - default {'Unknown'} + 'Direct' { 'Direct' } + default { 'Unknown' } } } else { switch ($ObjStorage.GatewayServer.count) { - 0 {"Disable"} - 1 {$ObjStorage.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $ObjStorage.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } } @@ -69,8 +68,7 @@ function Get-VbrBackupObjectRepoInfo { } return $ObjStorageInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupProtectedGroupInfo.ps1 b/Src/Private/Get-VbrBackupProtectedGroupInfo.ps1 index 8bd348a..b3b0747 100644 --- a/Src/Private/Get-VbrBackupProtectedGroupInfo.ps1 +++ b/Src/Private/Get-VbrBackupProtectedGroupInfo.ps1 @@ -29,12 +29,12 @@ function Get-VbrBackupProtectedGroupInfo { $Rows = @{ 'Type' = $ProtectedGroup.Type - 'Status' = Switch ($ProtectedGroup.Enabled) { - $true {'Enabled'} - $false {'Disabled'} - default {'Unknown'} + 'Status' = Switch ($ProtectedGroup.Enabled) { + $true { 'Enabled' } + $false { 'Disabled' } + default { 'Unknown' } } - 'Schedule' = $ProtectedGroup.ScheduleOptions.PolicyType + 'Schedule' = $ProtectedGroup.ScheduleOptions.PolicyType } $Type = Get-IconType -String $ProtectedGroup.Container.Type @@ -51,8 +51,7 @@ function Get-VbrBackupProtectedGroupInfo { } return $ProtectedGroupInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupProxyInfo.ps1 b/Src/Private/Get-VbrBackupProxyInfo.ps1 index d490709..9c0ee1f 100644 --- a/Src/Private/Get-VbrBackupProxyInfo.ps1 +++ b/Src/Private/Get-VbrBackupProxyInfo.ps1 @@ -27,9 +27,9 @@ function Get-VbrBackupProxyInfo { Write-Verbose -Message "Collecting Backup Proxy information from $($VBRServer.Name)." try { $BPType = switch ($Type) { - 'vmware' {Get-VBRViProxy} - 'hyperv' {Get-VBRHvProxy} - 'nas' {Get-VBRNASProxyServer} + 'vmware' { Get-VBRViProxy } + 'hyperv' { Get-VBRHvProxy } + 'nas' { Get-VBRNASProxyServer } } $BackupProxies = $BPType @@ -40,28 +40,28 @@ function Get-VbrBackupProxyInfo { # $Role = Get-RoleType -String $Type $Hostname = Switch ($Type) { - 'vmware' {$BackupProxy.Host.Name} - 'hyperv' {$BackupProxy.Host.Name} - 'nas' {$BackupProxy.Server.Name} + 'vmware' { $BackupProxy.Host.Name } + 'hyperv' { $BackupProxy.Host.Name } + 'nas' { $BackupProxy.Server.Name } } $Status = Switch ($Type) { 'vmware' { Switch ($BackupProxy.isDisabled) { - $false {'Enabled'} - $true {'Disabled'} + $false { 'Enabled' } + $true { 'Disabled' } } } 'hyperv' { Switch ($BackupProxy.isDisabled) { - $false {'Enabled'} - $true {'Disabled'} + $false { 'Enabled' } + $true { 'Disabled' } } } 'nas' { Switch ($BackupProxy.IsEnabled) { - $false {'Disabled'} - $true {'Enabled'} + $false { 'Disabled' } + $true { 'Enabled' } } } } @@ -70,26 +70,26 @@ function Get-VbrBackupProxyInfo { IP = Get-NodeIP -HostName $Hostname Status = $Status Type = Switch ($Type) { - 'vmware' {$BackupProxy.Host.Type} + 'vmware' { $BackupProxy.Host.Type } 'hyperv' { Switch ($BackupProxy.Info.Type) { - 'HvOffhost' {"Off-Host Backup"} - 'HvOnhost' {"On-Host Backup"} + 'HvOffhost' { "Off-Host Backup" } + 'HvOnhost' { "On-Host Backup" } } } - 'nas' {"File Backup"} + 'nas' { "File Backup" } } Concurrent_Tasks = Switch ($Type) { - 'vmware' {$BackupProxy.MaxTasksCount} - 'hyperv' {$BackupProxy.MaxTasksCount} - 'nas' {$BackupProxy.ConcurrentTaskNumber} + 'vmware' { $BackupProxy.MaxTasksCount } + 'hyperv' { $BackupProxy.MaxTasksCount } + 'nas' { $BackupProxy.ConcurrentTaskNumber } } } $IconType = Switch ($Type) { - 'vmware' {"VBR_Proxy_Server"} - 'hyperv' {"VBR_Proxy_Server"} - 'nas' {"VBR_AGENT_Server"} + 'vmware' { "VBR_Proxy_Server" } + 'hyperv' { "VBR_Proxy_Server" } + 'nas' { "VBR_AGENT_Server" } } $TempBackupProxyInfo = [PSCustomObject]@{ @@ -103,8 +103,7 @@ function Get-VbrBackupProxyInfo { } return $BackupProxyInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupRepoInfo.ps1 b/Src/Private/Get-VbrBackupRepoInfo.ps1 index f8ce810..7f48d9d 100644 --- a/Src/Private/Get-VbrBackupRepoInfo.ps1 +++ b/Src/Private/Get-VbrBackupRepoInfo.ps1 @@ -51,7 +51,7 @@ function Get-VbrBackupRepoInfo { if (($Role -ne 'Dedup Appliances') -and ($Role -ne 'SAN') -and ($BackupRepo.Host.Name -in $ViBackupProxy.Host.Name -or $BackupRepo.Host.Name -in $HvBackupProxy.Host.Name)) { $BackupType = 'Proxy' - } else {$BackupType = $BackupRepo.Type} + } else { $BackupType = $BackupRepo.Type } $Type = Get-IconType -String $BackupType @@ -66,8 +66,7 @@ function Get-VbrBackupRepoInfo { } return $BackupRepoInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupServerInfo.ps1 b/Src/Private/Get-VbrBackupServerInfo.ps1 index 1dda721..896c9fc 100644 --- a/Src/Private/Get-VbrBackupServerInfo.ps1 +++ b/Src/Private/Get-VbrBackupServerInfo.ps1 @@ -24,29 +24,27 @@ function Get-VbrBackupServerInfo { $PssSession = New-PSSession $VBRServer.Name -Credential $Credential -Authentication Negotiate Write-Verbose -Message "Collecting Backup Server information from $($VBRServer.Name)." try { - $VeeamVersion = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { get-childitem -recurse HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | get-itemproperty | Where-Object { $_.DisplayName -match 'Veeam Backup & Replication Server' } | Select-Object -Property DisplayVersion } - } catch {$_} + $VeeamVersion = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ChildItem -Recurse HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -match 'Veeam Backup & Replication Server' } | Select-Object -Property DisplayVersion } + } catch { $_ } try { $VeeamDBFlavor = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations' } - } catch {$_} + } catch { $_ } try { $VeeamDBInfo12 = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ItemProperty -Path "HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\$(($Using:VeeamDBFlavor).SqlActiveConfiguration)" } - } catch {$_} + } catch { $_ } try { $VeeamDBInfo11 = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication' } - } catch {$_} + } catch { $_ } if ($VeeamDBInfo11.SqlServerName) { $VeeamDBInfo = $VeeamDBInfo11.SqlServerName - } - elseif ($VeeamDBInfo12.SqlServerName) { + } elseif ($VeeamDBInfo12.SqlServerName) { $VeeamDBInfo = $VeeamDBInfo12.SqlServerName - } - elseif ($VeeamDBInfo12.SqlHostName) { - $VeeamDBInfo = Switch ($VeeamDBInfo12.SqlHostName) { - 'localhost' {$VBRServer.Name} - default {$VeeamDBInfo12.SqlHostName} - } + } elseif ($VeeamDBInfo12.SqlHostName) { + $VeeamDBInfo = Switch ($VeeamDBInfo12.SqlHostName) { + 'localhost' { $VBRServer.Name } + default { $VeeamDBInfo12.SqlHostName } + } } else { $VeeamDBInfo = $VBRServer.Name } @@ -79,8 +77,7 @@ function Get-VbrBackupServerInfo { Label = Get-NodeIcon -Name "$($VBRServer.Name.split(".")[0])" -Type "VBR_Server" -Align "Center" -Rows $Rows } } - } - catch { + } catch { $_ } try { @@ -118,8 +115,7 @@ function Get-VbrBackupServerInfo { DBPort = $DBPort } } - } - catch { + } catch { $_ } @@ -138,12 +134,10 @@ function Get-VbrBackupServerInfo { Label = Get-NodeIcon -Name "$($EMServer.ServerName.split(".")[0])" -Type "VBR_Server_EM" -Align "Center" -Rows $Rows } } - } - catch { + } catch { $_ } - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupSobrInfo.ps1 b/Src/Private/Get-VbrBackupSobrInfo.ps1 index 96ee713..3637465 100644 --- a/Src/Private/Get-VbrBackupSobrInfo.ps1 +++ b/Src/Private/Get-VbrBackupSobrInfo.ps1 @@ -37,13 +37,11 @@ function Get-VbrBackupSobrInfo { if ($Sobr.CapacityExtent.Repository.AmazonS3Folder) { $Folder = $Sobr.CapacityExtent.Repository.AmazonS3Folder - } - elseif ($Sobr.CapacityExtent.Repository.AzureBlobFolder) { + } elseif ($Sobr.CapacityExtent.Repository.AzureBlobFolder) { $Folder = $Sobr.CapacityExtent.Repository.AzureBlobFolder - } - elseif ($Sobr.ArchiveExtent.Repository.AzureBlobFolder) { + } elseif ($Sobr.ArchiveExtent.Repository.AzureBlobFolder) { $Folder = $Sobr.ArchiveExtent.Repository.AzureBlobFolder - } else {$Folder = 'Unknown'} + } else { $Folder = 'Unknown' } foreach ($Extent in $Sobr.Extent) { @@ -61,24 +59,24 @@ function Get-VbrBackupSobrInfo { $CapacityRows = @{ Type = $Sobr.CapacityExtent.Repository.Type Folder = "/$($Folder)" - Gateway = &{ + Gateway = & { if (-Not $Sobr.CapacityExtent.Repository.UseGatewayServer) { Switch ($Sobr.CapacityExtent.Repository.ConnectionType) { 'Gateway' { switch ($Sobr.CapacityExtent.Repository.GatewayServer.count) { - 0 {"Disable"} - 1 {$Sobr.CapacityExtent.Repository.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $Sobr.CapacityExtent.Repository.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } - 'Direct' {'Direct'} - default {'Unknown'} + 'Direct' { 'Direct' } + default { 'Unknown' } } } else { switch ($Sobr.CapacityExtent.Repository.GatewayServer.count) { - 0 {"Disable"} - 1 {$Sobr.CapacityExtent.Repository.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $Sobr.CapacityExtent.Repository.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } } @@ -86,24 +84,24 @@ function Get-VbrBackupSobrInfo { $ArchiveRows = [ordered]@{ Type = $Sobr.ArchiveExtent.Repository.ArchiveType - Gateway = &{ + Gateway = & { if (-Not $Sobr.ArchiveExtent.Repository.UseGatewayServer) { Switch ($Sobr.ArchiveExtent.Repository.GatewayMode) { 'Gateway' { switch ($Sobr.ArchiveExtent.Repository.GatewayServer.count) { - 0 {"Disable"} - 1 {$Sobr.ArchiveExtent.Repository.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $Sobr.ArchiveExtent.Repository.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } - 'Direct' {'Direct'} - default {'Unknown'} + 'Direct' { 'Direct' } + default { 'Unknown' } } } else { switch ($Sobr.ArchiveExtent.Repository.GatewayServer.count) { - 0 {"Disable"} - 1 {$Sobr.ArchiveExtent.Repository.GatewayServer.Name.Split('.')[0]} - Default {'Automatic'} + 0 { "Disable" } + 1 { $Sobr.ArchiveExtent.Repository.GatewayServer.Name.Split('.')[0] } + Default { 'Automatic' } } } } @@ -118,19 +116,18 @@ function Get-VbrBackupSobrInfo { Name = "$($Sobr.Name.toUpper())" Label = Get-NodeIcon -Name "$($Sobr.Name)" -Type "VBR_SOBR" -Align "Center" -Rows $SobrRows - Capacity = $Sobr.CapacityExtent.Repository | Select-Object -Property @{Name= 'Name'; Expression={Remove-SpecialChar -String $_.Name -SpecialChars '\'}},@{Name = 'Rows'; Expression={$CapacityRows}}, @{Name = 'Icon'; Expression={Get-IconType -String $_.Type}} + Capacity = $Sobr.CapacityExtent.Repository | Select-Object -Property @{Name = 'Name'; Expression = { Remove-SpecialChar -String $_.Name -SpecialChars '\' } }, @{Name = 'Rows'; Expression = { $CapacityRows } }, @{Name = 'Icon'; Expression = { Get-IconType -String $_.Type } } - Archive = $Sobr.ArchiveExtent.Repository | Select-Object -Property @{Name= 'Name'; Expression={Remove-SpecialChar -String $_.Name -SpecialChars '\'}},@{Name = 'Rows'; Expression={$ArchiveRows}}, @{Name = 'Icon'; Expression={Get-IconType -String $_.ArchiveType}} + Archive = $Sobr.ArchiveExtent.Repository | Select-Object -Property @{Name = 'Name'; Expression = { Remove-SpecialChar -String $_.Name -SpecialChars '\' } }, @{Name = 'Rows'; Expression = { $ArchiveRows } }, @{Name = 'Icon'; Expression = { Get-IconType -String $_.ArchiveType } } - Performance = $Sobr.Extent | Select-Object -Property @{Name= 'Name'; Expression={Remove-SpecialChar -String $_.Name -SpecialChars '\'}},@{Name = 'Rows'; Expression={$SOBRPERFHASHTABLE}}, @{Name = 'Icon'; Expression={Get-IconType -String $_.Repository.Type}} + Performance = $Sobr.Extent | Select-Object -Property @{Name = 'Name'; Expression = { Remove-SpecialChar -String $_.Name -SpecialChars '\' } }, @{Name = 'Rows'; Expression = { $SOBRPERFHASHTABLE } }, @{Name = 'Icon'; Expression = { Get-IconType -String $_.Repository.Type } } } $SobrInfo += $TempSobrInfo } } return $SobrInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupTapeDrivesInfo.ps1 b/Src/Private/Get-VbrBackupTapeDrivesInfo.ps1 index 6e17414..7aaaf17 100644 --- a/Src/Private/Get-VbrBackupTapeDrivesInfo.ps1 +++ b/Src/Private/Get-VbrBackupTapeDrivesInfo.ps1 @@ -25,7 +25,7 @@ function Get-VbrBackupTapeDrivesInfo { if ($TapeLibrary) { $TapeDrives = Get-VBRTapeDrive -Library $TapeLibrary - } Else {$TapeDrives = Get-VBRTapeDrive} + } Else { $TapeDrives = Get-VBRTapeDrive } $BackupTapeDriveInfo = @() if ($TapeDrives) { @@ -51,8 +51,7 @@ function Get-VbrBackupTapeDrivesInfo { } return $BackupTapeDriveInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupTapeLibraryInfo.ps1 b/Src/Private/Get-VbrBackupTapeLibraryInfo.ps1 index 27a8533..94868c8 100644 --- a/Src/Private/Get-VbrBackupTapeLibraryInfo.ps1 +++ b/Src/Private/Get-VbrBackupTapeLibraryInfo.ps1 @@ -25,7 +25,7 @@ function Get-VbrBackupTapeLibraryInfo { if ($TapeServer) { $TapeLibraries = Get-VBRTapeLibrary -TapeServer $TapeServer - } Else {$TapeLibraries = Get-VBRTapeLibrary} + } Else { $TapeLibraries = Get-VBRTapeLibrary } $BackupTapelibraryInfo = @() if ($TapeLibraries) { @@ -50,8 +50,7 @@ function Get-VbrBackupTapeLibraryInfo { } return $BackupTapelibraryInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupTapeServerInfo.ps1 b/Src/Private/Get-VbrBackupTapeServerInfo.ps1 index 9d2360b..60e4b8b 100644 --- a/Src/Private/Get-VbrBackupTapeServerInfo.ps1 +++ b/Src/Private/Get-VbrBackupTapeServerInfo.ps1 @@ -32,8 +32,8 @@ function Get-VbrBackupTapeServerInfo { IP = Get-NodeIP -HostName $TapeServer.Name Role = 'Tape Server' State = Switch ($TapeServer.IsAvailable) { - 'True' {'Available'} - 'False' {'Unavailable'} + 'True' { 'Available' } + 'False' { 'Unavailable' } } } @@ -49,8 +49,7 @@ function Get-VbrBackupTapeServerInfo { } return $BackupTapeServersInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrBackupWanAccelInfo.ps1 b/Src/Private/Get-VbrBackupWanAccelInfo.ps1 index 3fa6780..e11817d 100644 --- a/Src/Private/Get-VbrBackupWanAccelInfo.ps1 +++ b/Src/Private/Get-VbrBackupWanAccelInfo.ps1 @@ -22,7 +22,7 @@ function Get-VbrBackupWanAccelInfo { process { Write-Verbose -Message "Collecting Wan Accelerator information from $($VBRServer.Name)." try { - $WANACCELS = Get-VbrWanAccelerator + $WANACCELS = Get-VBRWANAccelerator $WANACCELInfo = @() if ($WANACCELS) { foreach ($WANACCEL in $WANACCELS) { @@ -48,8 +48,7 @@ function Get-VbrBackupWanAccelInfo { } return $WANACCELInfo - } - catch { + } catch { $_ } } diff --git a/Src/Private/Get-VbrRequiredModule.ps1 b/Src/Private/Get-VbrRequiredModule.ps1 index 4dae9d2..a2fa90b 100644 --- a/Src/Private/Get-VbrRequiredModule.ps1 +++ b/Src/Private/Get-VbrRequiredModule.ps1 @@ -37,17 +37,14 @@ function Get-VbrRequiredModule { try { Write-Verbose -Message "Trying to import Veeam B&R modules." $Modules | Import-Module -WarningAction SilentlyContinue -Verbose:$false - } - catch { + } catch { Write-Verbose -Message "Failed to load Veeam Modules" } - } - else { + } else { try { Write-Verbose -Message "No Veeam Modules found, Fallback to SnapIn." Add-PSSnapin -Name VeeamPSSnapIn -PassThru -ErrorAction Stop | Out-Null - } - catch { + } catch { Write-Verbose -Message "Failed to load VeeamPSSnapIn and no Modules found" } } @@ -55,28 +52,25 @@ function Get-VbrRequiredModule { try { Write-Verbose -Message "Identifying Veeam Powershell module version." switch ($Module.Version.ToString()) { - {$_ -eq "1.0"} { [int]$VbrVersion = "11" } - Default {[int]$VbrVersion = "11"} + { $_ -eq "1.0" } { [int]$VbrVersion = "11" } + Default { [int]$VbrVersion = "11" } } Write-Verbose -Message "Using Veeam Powershell module version $($VbrVersion)." - } - catch { + } catch { Write-Verbose -Message "Failed to get Version from Module" } - } - else { + } else { try { Write-Verbose -Message "No Veeam Modules found, Fallback to SnapIn." [int]$VbrVersion = (Get-PSSnapin VeeamPSSnapin -ErrorAction SilentlyContinue).PSVersion.ToString() - } - catch { + } catch { Write-Verbose -Message "Failed to get Version from Module or SnapIn" } } # Check if the required version of VMware PowerCLI is installed $RequiredModule = Get-Module -ListAvailable -Name $Name | Sort-Object -Property Version -Descending | Select-Object -First 1 $ModuleVersion = "$($RequiredModule.Version.Major)" + "." + "$($RequiredModule.Version.Minor)" - if ($ModuleVersion -eq ".") { + if ($ModuleVersion -eq ".") { throw "$Name $Version or higher is required to run the Veeam VBR As Built Report. Install the Veeam Backup & Replication console that provide the required modules." } if ($ModuleVersion -lt $Version) { diff --git a/Src/Private/Get-VbrServerConnection.ps1 b/Src/Private/Get-VbrServerConnection.ps1 index c5509d5..00e4b7f 100644 --- a/Src/Private/Get-VbrServerConnection.ps1 +++ b/Src/Private/Get-VbrServerConnection.ps1 @@ -32,28 +32,24 @@ function Get-VbrServerConnection { Write-Verbose -Message "Looking for veeam existing server connection." #Code taken from @vMarkus_K $OpenConnection = (Get-VBRServerSession).Server - if($OpenConnection -eq $System) { + if ($OpenConnection -eq $System) { Write-Verbose -Message "Existing veeam server connection found" - } - elseif ($null -eq $OpenConnection) { + } elseif ($null -eq $OpenConnection) { Write-Verbose -Message "No existing veeam server connection found" try { Write-Verbose -Message "Connecting to $($System) with $($Credential.USERNAME) credentials" Connect-VBRServer -Server $System -Credential $Credential -Port $Port - } - catch { + } catch { Write-Verbose "$($_.Exception.Message)" Throw "Failed to connect to Veeam Backup Server Host $($System):$($Port) with username $($Credential.USERNAME)" } - } - else { + } else { Write-Verbose -Message "Actual veeam server connection not equal to $($System). Disconecting connection." Disconnect-VBRServer try { Write-Verbose -Message "Trying to open a new connection to $($System)" Connect-VBRServer -Server $System -Credential $Credential -Port $Port - } - catch { + } catch { Write-Verbose $_.Exception.Message Throw "Failed to connect to Veeam Backup Server Host $($System):$($Port) with username $($Credential.USERNAME)" } @@ -63,8 +59,7 @@ function Get-VbrServerConnection { if ($null -eq $NewConnection) { Write-Verbose $_.Exception.Message Throw "Failed to connect to Veeam Backup Server Host $($System):$($Port) with username $($Credential.USERNAME)" - } - elseif ($NewConnection) { + } elseif ($NewConnection) { Write-Verbose -Message "Successfully connected to $($System):$($Port) Backup Server." } } diff --git a/Src/Private/Out-VbrDiagram.ps1 b/Src/Private/Out-VbrDiagram.ps1 index 0d91d04..434ce80 100644 --- a/Src/Private/Out-VbrDiagram.ps1 +++ b/Src/Private/Out-VbrDiagram.ps1 @@ -44,14 +44,14 @@ function Out-VbrDiagram { if ($Filename) { Try { if ($OutputFormat -ne "base64") { - if($OutputFormat -ne "svg") { + if ($OutputFormat -ne "svg") { $Document = Export-PSGraph -Source $GraphObj -DestinationPath "$($OutputFolderPath)$($FileName)" -OutputFormat $OutputFormat -GraphVizPath $GraphvizPath Write-ColorOutput -Color green "Diagram '$FileName' has been saved to '$OutputFolderPath'." } else { $Document = Export-PSGraph -Source $GraphObj -DestinationPath "$($OutputFolderPath)$($FileName)" -OutputFormat $OutputFormat -GraphVizPath $GraphvizPath #Fix icon path issue with svg output $images = Select-String -Path $($Document.fullname) -Pattern '' -AllMatches - foreach($match in $images) { + foreach ($match in $images) { $matchFound = $match -Match '"(.*png)"' if ($matchFound -eq $false) { continue @@ -73,23 +73,23 @@ function Out-VbrDiagram { # Code used to allow rotating image! if ($Rotate) { Add-Type -AssemblyName System.Windows.Forms - $RotatedIMG = new-object System.Drawing.Bitmap $Document.FullName + $RotatedIMG = New-Object System.Drawing.Bitmap $Document.FullName $RotatedIMG.RotateFlip("Rotate$($Rotate)FlipNone") - $RotatedIMG.Save($Document.FullName,"png") + $RotatedIMG.Save($Document.FullName, "png") if ($RotatedIMG) { - $Base64 = [convert]::ToBase64String((get-content $Document -encoding byte)) + $Base64 = [convert]::ToBase64String((Get-Content $Document -Encoding byte)) if ($Base64) { Remove-Item -Path $Document.FullName $Base64 - } else {Remove-Item -Path $Document.FullName} + } else { Remove-Item -Path $Document.FullName } } } else { # Code used to output image to base64 format - $Base64 = [convert]::ToBase64String((get-content $Document -encoding byte)) + $Base64 = [convert]::ToBase64String((Get-Content $Document -Encoding byte)) if ($Base64) { Remove-Item -Path $Document.FullName $Base64 - } else {Remove-Item -Path $Document.FullName} + } else { Remove-Item -Path $Document.FullName } } } @@ -98,20 +98,19 @@ function Out-VbrDiagram { $Err = $_ Write-Error $Err } - } - elseif (!$Filename) { + } elseif (!$Filename) { if ($OutputFormat -ne "base64") { $File = "Output.$OutputFormat" - } else {$File = "Output.png"} + } else { $File = "Output.png" } Try { if ($OutputFormat -ne "base64") { - if($OutputFormat -ne "svg") { + if ($OutputFormat -ne "svg") { $Document = Export-PSGraph -Source $GraphObj -DestinationPath "$($OutputFolderPath)$($File)" -OutputFormat $OutputFormat -GraphVizPath $GraphvizPath Write-ColorOutput -Color green "Diagram '$File' has been saved to '$OutputFolderPath'." } else { $Document = Export-PSGraph -Source $GraphObj -DestinationPath "$($OutputFolderPath)$($File)" -OutputFormat $OutputFormat -GraphVizPath $GraphvizPath $images = Select-String -Path $($Document.fullname) -Pattern '' -AllMatches - foreach($match in $images) { + foreach ($match in $images) { $matchFound = $match -Match '"(.*png)"' if ($matchFound -eq $false) { continue @@ -132,23 +131,23 @@ function Out-VbrDiagram { # Code used to allow rotating image! if ($Rotate) { Add-Type -AssemblyName System.Windows.Forms - $RotatedIMG = new-object System.Drawing.Bitmap $Document.FullName + $RotatedIMG = New-Object System.Drawing.Bitmap $Document.FullName $RotatedIMG.RotateFlip("Rotate$($Rotate)FlipNone") - $RotatedIMG.Save($Document.FullName,"png") + $RotatedIMG.Save($Document.FullName, "png") if ($RotatedIMG) { - $Base64 = [convert]::ToBase64String((get-content $Document -encoding byte)) + $Base64 = [convert]::ToBase64String((Get-Content $Document -Encoding byte)) if ($Base64) { Remove-Item -Path $Document.FullName $Base64 - } else {Remove-Item -Path $Document.FullName} + } else { Remove-Item -Path $Document.FullName } } } else { # Code used to output image to base64 format - $Base64 = [convert]::ToBase64String((get-content $Document -encoding byte)) + $Base64 = [convert]::ToBase64String((Get-Content $Document -Encoding byte)) if ($Base64) { Remove-Item -Path $Document.FullName $Base64 - } else {Remove-Item -Path $Document.FullName} + } else { Remove-Item -Path $Document.FullName } } } } diff --git a/Src/Private/SharedUtilsFunctions.ps1 b/Src/Private/SharedUtilsFunctions.ps1 index 6a137d4..9765bd7 100644 --- a/Src/Private/SharedUtilsFunctions.ps1 +++ b/Src/Private/SharedUtilsFunctions.ps1 @@ -18,8 +18,7 @@ function Remove-SpecialChar { [string]$SpecialChars = "()[]{}&." ) - if ($PSCmdlet.ShouldProcess($String, ("Remove {0} chars" -f $SpecialChars,$String))) - { + if ($PSCmdlet.ShouldProcess($String, ("Remove {0} chars" -f $SpecialChars, $String))) { $String -replace $($SpecialChars.ToCharArray().ForEach( { [regex]::Escape($_) }) -join "|"), "" } } @@ -41,25 +40,25 @@ function Get-IconType { ) $IconType = Switch ($String) { - 'LinuxLocal' {'VBR_Linux_Repository'} - 'WinLocal' {'VBR_Windows_Repository'} - 'Cloud' {'VBR_Cloud_Repository'} - 'AzureBlob' {'VBR_Cloud_Repository'} - 'AmazonS3' {'VBR_Cloud_Repository'} - 'AmazonS3Compatible' {'VBR_Cloud_Repository'} - 'AmazonS3Glacier' {'VBR_Cloud_Repository'} - 'AzureArchive' {'VBR_Cloud_Repository'} - 'DDBoost' {'VBR_Deduplicating_Storage'} - 'HPStoreOnceIntegration' {'VBR_Deduplicating_Storage'} - 'SanSnapshotOnly' {'VBR_Storage_NetApp'} - 'Proxy' {'VBR_Repository'} - 'ESXi' {'VBR_ESXi_Server'} - 'HyperVHost' {'Hyper-V_host'} - 'ManuallyDeployed' {'VBR_AGENT_MC'} - 'IndividualComputers' {'VBR_AGENT_IC'} - 'ActiveDirectory' {'VBR_AGENT_AD'} - 'CSV' {'VBR_AGENT_CSV'} - default {'VBR_No_Icon'} + 'LinuxLocal' { 'VBR_Linux_Repository' } + 'WinLocal' { 'VBR_Windows_Repository' } + 'Cloud' { 'VBR_Cloud_Repository' } + 'AzureBlob' { 'VBR_Cloud_Repository' } + 'AmazonS3' { 'VBR_Cloud_Repository' } + 'AmazonS3Compatible' { 'VBR_Cloud_Repository' } + 'AmazonS3Glacier' { 'VBR_Cloud_Repository' } + 'AzureArchive' { 'VBR_Cloud_Repository' } + 'DDBoost' { 'VBR_Deduplicating_Storage' } + 'HPStoreOnceIntegration' { 'VBR_Deduplicating_Storage' } + 'SanSnapshotOnly' { 'VBR_Storage_NetApp' } + 'Proxy' { 'VBR_Repository' } + 'ESXi' { 'VBR_ESXi_Server' } + 'HyperVHost' { 'Hyper-V_host' } + 'ManuallyDeployed' { 'VBR_AGENT_MC' } + 'IndividualComputers' { 'VBR_AGENT_IC' } + 'ActiveDirectory' { 'VBR_AGENT_AD' } + 'CSV' { 'VBR_AGENT_CSV' } + default { 'VBR_No_Icon' } } return $IconType @@ -81,17 +80,17 @@ function Get-RoleType { ) $RoleType = Switch ($String) { - 'LinuxLocal' {'Linux Local'} - 'WinLocal' {'Windows Local'} - 'DDBoost' {'Dedup Appliances'} - 'HPStoreOnceIntegration' {'Dedup Appliances'} - 'Cloud' {'Cloud'} - 'SanSnapshotOnly' {'SAN'} - "vmware" {'VMware Backup Proxy'} - "hyperv" {'HyperV Backup Proxy'} - "agent" {'Agent & Files Backup Proxy'} - "nas" {'NAS Backup Proxy'} - default {'Backup Repository'} + 'LinuxLocal' { 'Linux Local' } + 'WinLocal' { 'Windows Local' } + 'DDBoost' { 'Dedup Appliances' } + 'HPStoreOnceIntegration' { 'Dedup Appliances' } + 'Cloud' { 'Cloud' } + 'SanSnapshotOnly' { 'SAN' } + "vmware" { 'VMware Backup Proxy' } + "hyperv" { 'HyperV Backup Proxy' } + "agent" { 'Agent & Files Backup Proxy' } + "nas" { 'NAS Backup Proxy' } + default { 'Backup Repository' } } return $RoleType @@ -115,20 +114,19 @@ function Get-NodeIP { try { try { if ("InterNetwork" -in [System.Net.Dns]::GetHostAddresses($Hostname).AddressFamily) { - $IPADDR = ([System.Net.Dns]::GetHostAddresses($Hostname) | Where-Object {$_.AddressFamily -eq 'InterNetwork'}).IPAddressToString + $IPADDR = ([System.Net.Dns]::GetHostAddresses($Hostname) | Where-Object { $_.AddressFamily -eq 'InterNetwork' }).IPAddressToString } elseif ("InterNetworkV6" -in [System.Net.Dns]::GetHostAddresses($Hostname).AddressFamily) { - $IPADDR = ([System.Net.Dns]::GetHostAddresses($Hostname) | Where-Object {$_.AddressFamily -eq 'InterNetworkV6'}).IPAddressToString + $IPADDR = ([System.Net.Dns]::GetHostAddresses($Hostname) | Where-Object { $_.AddressFamily -eq 'InterNetworkV6' }).IPAddressToString } else { $IPADDR = 127.0.0.1 } } catch { $null } $NodeIP = Switch ([string]::IsNullOrEmpty($IPADDR)) { - $true {'Unknown'} - $false {$IPADDR} - default {$Hostname} + $true { 'Unknown' } + $false { $IPADDR } + default { $Hostname } } - } - catch { + } catch { $_ } @@ -150,26 +148,26 @@ function ConvertTo-TextYN { [OutputType([String])] Param - ( + ( [Parameter ( Position = 0, Mandatory)] - [AllowEmptyString()] - [string] - $TEXT - ) + [AllowEmptyString()] + [string] + $TEXT + ) switch ($TEXT) { - "" {"-"} - $Null {"-"} - "True" {"Yes"; break} - "False" {"No"; break} - default {$TEXT} + "" { "-" } + $Null { "-" } + "True" { "Yes"; break } + "False" { "No"; break } + default { $TEXT } } } # end function Write-ColorOutput { - <# + <# .SYNOPSIS Used by Veeam.Diagrammer to output colored text. .DESCRIPTION @@ -184,21 +182,21 @@ function Write-ColorOutput { [OutputType([String])] Param - ( - [Parameter( - Position = 0, - Mandatory = $true - )] - [ValidateNotNullOrEmpty()] - [String] $Color, - - [Parameter( - Position = 1, - Mandatory = $true - )] - [ValidateNotNullOrEmpty()] - [String] $String - ) + ( + [Parameter( + Position = 0, + Mandatory = $true + )] + [ValidateNotNullOrEmpty()] + [String] $Color, + + [Parameter( + Position = 1, + Mandatory = $true + )] + [ValidateNotNullOrEmpty()] + [String] $String + ) # save the current color $ForegroundColor = $Host.UI.RawUI.ForegroundColor @@ -230,20 +228,20 @@ function Split-array { } $outArray = @() - for ($i=1; $i -le $parts; $i++) { - $start = (($i-1)*$PartSize) - $end = (($i)*$PartSize) - 1 + for ($i = 1; $i -le $parts; $i++) { + $start = (($i - 1) * $PartSize) + $end = (($i) * $PartSize) - 1 if ($end -ge $inArray.count) { $end = $inArray.count } - $outArray+=,@($inArray[$start..$end]) + $outArray += , @($inArray[$start..$end]) } - return ,$outArray + return , $outArray } function Test-Image { - <# + <# .SYNOPSIS Used by Veeam.Diagrammer to validate supported logo image extension. .DESCRIPTION @@ -259,7 +257,7 @@ function Test-Image { [CmdletBinding()] param( - [parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] [ValidateNotNullOrEmpty()] [Alias('PSPath')] $Path @@ -289,7 +287,7 @@ function Test-Logo { [OutputType([String])] param( - [parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] $LogoPath, [Switch] $Signature ) @@ -305,7 +303,7 @@ function Test-Logo { if (Test-Image -Path $LogoPath) { # Add logo path to the Image variable Copy-Item -Path $LogoPath -Destination $IconPath - $outputLogoFile = Split-Path $LogoPath -leaf + $outputLogoFile = Split-Path $LogoPath -Leaf if ($outputLogoFile) { $Images.Add("Custom", $outputLogoFile) return "Custom" diff --git a/Src/Public/New-VeeamDiagram.ps1 b/Src/Public/New-VeeamDiagram.ps1 index f68af49..862b7b5 100644 --- a/Src/Public/New-VeeamDiagram.ps1 +++ b/Src/Public/New-VeeamDiagram.ps1 @@ -154,12 +154,12 @@ function New-VeeamDiagram { HelpMessage = 'Please provide the path to the diagram output file' )] [ValidateScript( { - if (Test-Path -Path $_) { - $true - } else { - throw "Path $_ not found!" - } - })] + if (Test-Path -Path $_) { + $true + } else { + throw "Path $_ not found!" + } + })] [string] $OutputFolderPath = [System.IO.Path]::GetTempPath(), [Parameter( @@ -167,12 +167,12 @@ function New-VeeamDiagram { HelpMessage = 'Please provide the path to the custom logo used for Signature' )] [ValidateScript( { - if (Test-Path -Path $_) { - $true - } else { - throw "File $_ not found!" - } - })] + if (Test-Path -Path $_) { + $true + } else { + throw "File $_ not found!" + } + })] [string] $SignatureLogo, [Parameter( @@ -180,12 +180,12 @@ function New-VeeamDiagram { HelpMessage = 'Please provide the path to the custom logo' )] [ValidateScript( { - if (Test-Path -Path $_) { - $true - } else { - throw "File $_ not found!" - } - })] + if (Test-Path -Path $_) { + $true + } else { + throw "File $_ not found!" + } + })] [string] $Logo, [Parameter( @@ -194,12 +194,12 @@ function New-VeeamDiagram { )] [ValidateNotNullOrEmpty()] [ValidateScript({ - if ($Format.count -lt 2) { - $true - } else { - throw "Format value must be unique if Filename is especified." - } - })] + if ($Format.count -lt 2) { + $true + } else { + throw "Format value must be unique if Filename is especified." + } + })] [String] $Filename, [Parameter( @@ -227,7 +227,7 @@ function New-VeeamDiagram { Mandatory = $true, HelpMessage = 'Controls type of Veeam VBR generated diagram' )] - [ValidateSet('Backup-to-Tape', 'Backup-to-File-Proxy', 'Backup-to-HyperV-Proxy', 'Backup-to-vSphere-Proxy', 'Backup-to-Repository', 'Backup-to-Sobr', 'Backup-to-WanAccelerator','Backup-to-ProtectedGroup', 'Backup-to-All')] + [ValidateSet('Backup-to-Tape', 'Backup-to-File-Proxy', 'Backup-to-HyperV-Proxy', 'Backup-to-vSphere-Proxy', 'Backup-to-Repository', 'Backup-to-Sobr', 'Backup-to-WanAccelerator', 'Backup-to-ProtectedGroup', 'Backup-to-All')] [string] $DiagramType, [Parameter( @@ -264,7 +264,7 @@ function New-VeeamDiagram { HelpMessage = 'Allow the creation of footer signature' )] [Switch] $Signature = $false - ) + ) begin { @@ -276,7 +276,7 @@ function New-VeeamDiagram { $Credential = New-Object System.Management.Automation.PSCredential ($Username, $SecurePassword) } - if (($Format -ne "base64") -and !(Test-Path $OutputFolderPath)) { + if (($Format -ne "base64") -and !(Test-Path $OutputFolderPath)) { Write-Error "OutputFolderPath '$OutputFolderPath' is not a valid folder path." break } @@ -286,35 +286,35 @@ function New-VeeamDiagram { } $MainGraphLabel = Switch ($DiagramType) { - 'Backup-to-Sobr' {'Scale-Out Backup Repository Diagram'} - 'Backup-to-File-Proxy' {'File Backup Proxy Diagram'} - 'Backup-to-vSphere-Proxy' {'VMware Backup Proxy Diagram'} - 'Backup-to-HyperV-Proxy' {'HyperV Backup Proxy Diagram'} - 'Backup-to-Repository' {'Backup Repository Diagram'} - 'Backup-to-WanAccelerator' {'Wan Accelerators Diagram'} - 'Backup-to-Tape' {'Tape Infrastructure Diagram'} - 'Backup-to-ProtectedGroup' {'Physical Infrastructure Diagram'} - 'Backup-to-All' {'Backup Infrastructure Diagram'} + 'Backup-to-Sobr' { 'Scale-Out Backup Repository Diagram' } + 'Backup-to-File-Proxy' { 'File Backup Proxy Diagram' } + 'Backup-to-vSphere-Proxy' { 'VMware Backup Proxy Diagram' } + 'Backup-to-HyperV-Proxy' { 'HyperV Backup Proxy Diagram' } + 'Backup-to-Repository' { 'Backup Repository Diagram' } + 'Backup-to-WanAccelerator' { 'Wan Accelerators Diagram' } + 'Backup-to-Tape' { 'Tape Infrastructure Diagram' } + 'Backup-to-ProtectedGroup' { 'Physical Infrastructure Diagram' } + 'Backup-to-All' { 'Backup Infrastructure Diagram' } } $URLIcon = $false if ($EnableEdgeDebug) { - $EdgeDebug = @{style='filled'; color='red'} + $EdgeDebug = @{style = 'filled'; color = 'red' } $URLIcon = $true - } else {$EdgeDebug = @{style='invis'; color='red'}} + } else { $EdgeDebug = @{style = 'invis'; color = 'red' } } if ($EnableSubGraphDebug) { - $SubGraphDebug = @{style='dashed'; color='red'} + $SubGraphDebug = @{style = 'dashed'; color = 'red' } $URLIcon = $true - } else {$SubGraphDebug = @{style='invis'; color='gray'}} + } else { $SubGraphDebug = @{style = 'invis'; color = 'gray' } } $RootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $IconPath = Join-Path $RootPath 'icons' $script:GraphvizPath = Join-Path $RootPath 'Graphviz\bin\dot.exe' $Dir = switch ($Direction) { - 'top-to-bottom' {'TB'} - 'left-to-right' {'LR'} + 'top-to-bottom' { 'TB' } + 'left-to-right' { 'LR' } } # Validate Custom logo @@ -327,13 +327,13 @@ function New-VeeamDiagram { $MainGraphAttributes = @{ pad = 1.0 - rankdir = $Dir - overlap = 'false' - splines = $EdgeType - penwidth = 1.5 - fontname = "Segoe Ui Black" + rankdir = $Dir + overlap = 'false' + splines = $EdgeType + penwidth = 1.5 + fontname = "Segoe Ui Black" fontcolor = '#005f4b' - fontsize = 32 + fontsize = 32 style = "dashed" labelloc = 't' imagepath = $IconPath @@ -352,13 +352,13 @@ function New-VeeamDiagram { $script:VBRServer = Get-VBRServer -Type Local - } Catch {throw "Unable to get Veeam B&R Server"} + } Catch { throw "Unable to get Veeam B&R Server" } - Get-VbrBackupServerInfo + Get-VBRBackupServerInfo $script:Graph = Graph -Name VeeamVBR -Attributes $MainGraphAttributes { # Node default theme - node @{ + Node @{ label = '' shape = 'none' labelloc = 't' @@ -368,7 +368,7 @@ function New-VeeamDiagram { imagescale = $true } # Edge default theme - edge @{ + Edge @{ style = 'dashed' dir = 'both' arrowtail = 'dot' @@ -377,9 +377,9 @@ function New-VeeamDiagram { arrowsize = 1 } - SubGraph MainGraph -Attributes @{Label=(Get-HTMLLabel -Label $MainGraphLabel -Type $CustomLogo); fontsize=24; penwidth=0} { + SubGraph MainGraph -Attributes @{Label = (Get-HTMLLabel -Label $MainGraphLabel -Type $CustomLogo); fontsize = 24; penwidth = 0 } { - SubGraph BackupServer -Attributes @{Label='Backup Server'; style="rounded"; bgcolor="#ceedc4"; fontsize=18; penwidth=2} { + SubGraph BackupServer -Attributes @{Label = 'Backup Server'; style = "rounded"; bgcolor = "#ceedc4"; fontsize = 18; penwidth = 2 } { if (($DatabaseServerInfo.Name -ne $BackupServerInfo.Name) -and $EMServerInfo) { Write-Verbose -Message "Collecting Backup Server, Database Server and Enterprise Manager Information." $BSHASHTABLE = @{} @@ -390,21 +390,20 @@ function New-VeeamDiagram { $DatabaseServerInfo.psobject.properties | ForEach-Object { $DBHASHTABLE[$_.Name] = $_.Value } $EMServerInfo.psobject.properties | ForEach-Object { $EMHASHTABLE[$_.Name] = $_.Value } - node $BackupServerInfo.Name -Attributes @{Label=$BSHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} - node $DatabaseServerInfo.Name -Attributes @{Label=$DBHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} - node $EMServerInfo.Name -Attributes @{Label=$EMHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} + Node $BackupServerInfo.Name -Attributes @{Label = $BSHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } + Node $DatabaseServerInfo.Name -Attributes @{Label = $DBHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } + Node $EMServerInfo.Name -Attributes @{Label = $EMHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } if ($Dir -eq 'LR') { - rank $EMServerInfo.Name,$DatabaseServerInfo.Name - edge -from $EMServerInfo.Name -to $BackupServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3;} - edge -from $DatabaseServerInfo.Name -to $BackupServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3; xlabel=$DatabaseServerInfo.DBPort} + Rank $EMServerInfo.Name, $DatabaseServerInfo.Name + Edge -From $EMServerInfo.Name -To $BackupServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; } + Edge -From $DatabaseServerInfo.Name -To $BackupServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; xlabel = $DatabaseServerInfo.DBPort } } else { - rank $EMServerInfo.Name,$BackupServerInfo.Name,$DatabaseServerInfo.Name - edge -from $EMServerInfo.Name -to $BackupServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3;} - edge -from $BackupServerInfo.Name -to $DatabaseServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3; xlabel=$DatabaseServerInfo.DBPort} + Rank $EMServerInfo.Name, $BackupServerInfo.Name, $DatabaseServerInfo.Name + Edge -From $EMServerInfo.Name -To $BackupServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; } + Edge -From $BackupServerInfo.Name -To $DatabaseServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; xlabel = $DatabaseServerInfo.DBPort } } - } - elseif (($DatabaseServerInfo.Name -ne $BackupServerInfo.Name) -and (-Not $EMServerInfo)) { + } elseif (($DatabaseServerInfo.Name -ne $BackupServerInfo.Name) -and (-Not $EMServerInfo)) { Write-Verbose -Message "Not Enterprise Manager Found: Collecting Backup Server and Database server Information." $BSHASHTABLE = @{} $DBHASHTABLE = @{} @@ -412,18 +411,17 @@ function New-VeeamDiagram { $BackupServerInfo.psobject.properties | ForEach-Object { $BSHASHTABLE[$_.Name] = $_.Value } $DatabaseServerInfo.psobject.properties | ForEach-Object { $DBHASHTABLE[$_.Name] = $_.Value } - node $BackupServerInfo.Name -Attributes @{Label=$BSHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} - node $DatabaseServerInfo.Name -Attributes @{Label=$DBHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} + Node $BackupServerInfo.Name -Attributes @{Label = $BSHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } + Node $DatabaseServerInfo.Name -Attributes @{Label = $DBHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } if ($Dir -eq 'LR') { - rank $BackupServerInfo.Name,$DatabaseServerInfo.Name - edge -from $DatabaseServerInfo.Name -to $BackupServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3; xlabel=$DatabaseServerInfo.DBPort} + Rank $BackupServerInfo.Name, $DatabaseServerInfo.Name + Edge -From $DatabaseServerInfo.Name -To $BackupServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; xlabel = $DatabaseServerInfo.DBPort } } else { - rank $BackupServerInfo.Name,$DatabaseServerInfo.Name - edge -from $BackupServerInfo.Name -to $DatabaseServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3; xlabel=$DatabaseServerInfo.DBPort} + Rank $BackupServerInfo.Name, $DatabaseServerInfo.Name + Edge -From $BackupServerInfo.Name -To $DatabaseServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; xlabel = $DatabaseServerInfo.DBPort } } - } - elseif ($EMServerInfo -and ($DatabaseServerInfo.Name -eq $BackupServerInfo.Name)) { + } elseif ($EMServerInfo -and ($DatabaseServerInfo.Name -eq $BackupServerInfo.Name)) { Write-Verbose -Message "Database server colocated with Backup Server: Collecting Backup Server and Enterprise Manager Information." $BSHASHTABLE = @{} $EMHASHTABLE = @{} @@ -431,26 +429,26 @@ function New-VeeamDiagram { $BackupServerInfo.psobject.properties | ForEach-Object { $BSHASHTABLE[$_.Name] = $_.Value } $EMServerInfo.psobject.properties | ForEach-Object { $EMHASHTABLE[$_.Name] = $_.Value } - node $BackupServerInfo.Name -Attributes @{Label=$BSHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} - node $EMServerInfo.Name -Attributes @{Label=$EMHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} + Node $BackupServerInfo.Name -Attributes @{Label = $BSHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } + Node $EMServerInfo.Name -Attributes @{Label = $EMHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } if ($Dir -eq 'LR') { - rank $EMServerInfo.Name,$BackupServerInfo.Name - edge -from $EMServerInfo.Name -to $BackupServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3;} + Rank $EMServerInfo.Name, $BackupServerInfo.Name + Edge -From $EMServerInfo.Name -To $BackupServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; } } else { - rank $EMServerInfo.Name,$BackupServerInfo.Name - edge -from $BackupServerInfo.Name -to $EMServerInfo.Name @{arrowtail="normal"; arrowhead="normal"; minlen=3;} + Rank $EMServerInfo.Name, $BackupServerInfo.Name + Edge -From $BackupServerInfo.Name -To $EMServerInfo.Name @{arrowtail = "normal"; arrowhead = "normal"; minlen = 3; } } } else { Write-Verbose -Message "Database server colocated with Backup Server and no Enterprise Manager found: Collecting Backup Server Information." $BSHASHTABLE = @{} $BackupServerInfo.psobject.properties | ForEach-Object { $BSHASHTABLE[$_.Name] = $_.Value } - node Left @{Label='Left'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node Leftt @{Label='Leftt'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node Right @{Label='Right'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'; fillColor='transparent'} - node $BackupServerInfo.Name -Attributes @{Label=$BSHASHTABLE.Label; fillColor='#ceedc4'; shape='plain'} - edge Left,Leftt,$BackupServerInfo.Name,Right @{style=$EdgeDebug.style; color=$EdgeDebug.color} - rank Left,Leftt,$BackupServerInfo.Name,Right + Node Left @{Label = 'Left'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node Leftt @{Label = 'Leftt'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node Right @{Label = 'Right'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain'; fillColor = 'transparent' } + Node $BackupServerInfo.Name -Attributes @{Label = $BSHASHTABLE.Label; fillColor = '#ceedc4'; shape = 'plain' } + Edge Left, Leftt, $BackupServerInfo.Name, Right @{style = $EdgeDebug.style; color = $EdgeDebug.color } + Rank Left, Leftt, $BackupServerInfo.Name, Right } } @@ -461,70 +459,62 @@ function New-VeeamDiagram { } else { Write-Warning "No HyperV Proxy Infrastructure available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-vSphere-Proxy') { + } elseif ($DiagramType -eq 'Backup-to-vSphere-Proxy') { $BackuptovSphereProxy = Get-DiagBackupToViProxy if ($BackuptovSphereProxy) { $BackuptovSphereProxy } else { Write-Warning "No vSphere Proxy Infrastructure available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-File-Proxy') { + } elseif ($DiagramType -eq 'Backup-to-File-Proxy') { $BackuptoFileProxy = Get-DiagBackupToFileProxy if ($BackuptoFileProxy) { $BackuptoFileProxy } else { Write-Warning "No File Proxy Infrastructure available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-WanAccelerator') { + } elseif ($DiagramType -eq 'Backup-to-WanAccelerator') { $BackuptoWanAccelerator = Get-DiagBackupToWanAccel if ($BackuptoWanAccelerator) { $BackuptoWanAccelerator } else { Write-Warning "No Wan Accelerators available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-Repository') { + } elseif ($DiagramType -eq 'Backup-to-Repository') { $BackuptoRepository = Get-DiagBackupToRepo if ($BackuptoRepository) { $BackuptoRepository } else { throw "No Backup Repository available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-ProtectedGroup') { + } elseif ($DiagramType -eq 'Backup-to-ProtectedGroup') { $BackuptoProtectedGroup = Get-DiagBackupToProtectedGroup if ($BackuptoProtectedGroup) { $BackuptoProtectedGroup } else { throw "No Backup Protected Group available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-Tape') { + } elseif ($DiagramType -eq 'Backup-to-Tape') { $BackupToTape = Get-DiagBackupToTape if ($BackupToTape) { $BackupToTape } else { Write-Warning "No Tape Infrastructure available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-Sobr') { + } elseif ($DiagramType -eq 'Backup-to-Sobr') { $BackuptoSobr = Get-DiagBackupToSobr if ($BackuptoSobr) { $BackuptoSobr } else { throw "No Scale-Out Backup Repository available to diagram" } - } - elseif ($DiagramType -eq 'Backup-to-All') { + } elseif ($DiagramType -eq 'Backup-to-All') { if (Get-DiagBackupToHvProxy) { Get-DiagBackupToHvProxy - } else {Write-Warning "No HyperV Proxy Infrastructure available to diagram"} + } else { Write-Warning "No HyperV Proxy Infrastructure available to diagram" } if (Get-DiagBackupToViProxy) { Get-DiagBackupToViProxy - } else {Write-Warning "No vSphere Proxy Infrastructure available to diagram"} + } else { Write-Warning "No vSphere Proxy Infrastructure available to diagram" } Get-DiagBackupToWanAccel Get-DiagBackupToRepo @@ -533,15 +523,15 @@ function New-VeeamDiagram { } } if ($Signature) { - SubGraph Legend @{Label=" "; style='dashed,rounded'; color=$SubGraphDebug.color; fontsize=1} { + SubGraph Legend @{Label = " "; style = 'dashed,rounded'; color = $SubGraphDebug.color; fontsize = 1 } { if ($CustomSignatureLogo) { - node LegendTable -Attributes @{Label=(Get-HTMLTable -Rows "Author: $($AuthorName)","Company: $($CompanyName)" -TableBorder 0 -CellBorder 0 -align 'left' -Logo $CustomSignatureLogo); shape='plain'} + Node LegendTable -Attributes @{Label = (Get-HtmlTable -Rows "Author: $($AuthorName)", "Company: $($CompanyName)" -TableBorder 0 -CellBorder 0 -align 'left' -Logo $CustomSignatureLogo); shape = 'plain' } } else { - node LegendTable -Attributes @{Label=(Get-HTMLTable -Rows "Author: $($AuthorName)","Company: $($CompanyName)" -TableBorder 0 -CellBorder 0 -align 'left' -Logo "VBR_LOGO_Footer"); shape='plain'} + Node LegendTable -Attributes @{Label = (Get-HtmlTable -Rows "Author: $($AuthorName)", "Company: $($CompanyName)" -TableBorder 0 -CellBorder 0 -align 'left' -Logo "VBR_LOGO_Footer"); shape = 'plain' } } } - inline {rank="sink"; "Legend"; "LegendTable";} - edge -from MainSubGraph:s -to LegendTable @{minlen=5; constrains='false'; style=$EdgeDebug.style; color=$EdgeDebug.color} + Inline { rank="sink"; "Legend"; "LegendTable"; } + Edge -From MainSubGraph:s -To LegendTable @{minlen = 5; constrains = 'false'; style = $EdgeDebug.style; color = $EdgeDebug.color } } } } diff --git a/Veeam.Diagrammer.psd1 b/Veeam.Diagrammer.psd1 index 5b26434..3731023 100644 --- a/Veeam.Diagrammer.psd1 +++ b/Veeam.Diagrammer.psd1 @@ -8,116 +8,116 @@ @{ -# Script module or binary module file associated with this manifest. -RootModule = 'Veeam.Diagrammer.psm1' + # Script module or binary module file associated with this manifest. + RootModule = 'Veeam.Diagrammer.psm1' -# Version number of this module. -ModuleVersion = '0.5.8' + # Version number of this module. + ModuleVersion = '0.5.8' -# Supported PSEditions -# CompatiblePSEditions = @() + # Supported PSEditions + # CompatiblePSEditions = @() -# ID used to uniquely identify this module -GUID = 'fb8ba2f3-1a28-4d1e-a2ab-04a9a96cd751' + # ID used to uniquely identify this module + GUID = 'fb8ba2f3-1a28-4d1e-a2ab-04a9a96cd751' -# Author of this module -Author = 'Jonathan Colon' + # Author of this module + Author = 'Jonathan Colon' -# Company or vendor of this module -CompanyName = 'Zen PR Solutions' + # Company or vendor of this module + CompanyName = 'Zen PR Solutions' -# Copyright statement for this module -Copyright = '(c) 2024 Jonathan Colon. All rights reserved.' + # Copyright statement for this module + Copyright = '(c) 2024 Jonathan Colon. All rights reserved.' -# Description of the functionality provided by this module -Description = 'A PowerShell module to generate an Veeam Backup & Replication infrastructure diagram' + # Description of the functionality provided by this module + Description = 'A PowerShell module to generate an Veeam Backup & Replication infrastructure diagram' -# Minimum version of the PowerShell engine required by this module -# PowerShellVersion = '' + # Minimum version of the PowerShell engine required by this module + # PowerShellVersion = '' -# Name of the PowerShell host required by this module -# PowerShellHostName = '' + # Name of the PowerShell host required by this module + # PowerShellHostName = '' -# Minimum version of the PowerShell host required by this module -# PowerShellHostVersion = '' + # Minimum version of the PowerShell host required by this module + # PowerShellHostVersion = '' -# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# DotNetFrameworkVersion = '' + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' -# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# ClrVersion = '' + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # ClrVersion = '' -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' -# Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'PSGraph'; ModuleVersion = '2.1.38.27'; }) + # Modules that must be imported into the global environment prior to importing this module + RequiredModules = @(@{ModuleName = 'PSGraph'; ModuleVersion = '2.1.38.27'; }) -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @() -# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = 'New-VeeamDiagram' + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = 'New-VeeamDiagram' -# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. -# CmdletsToExport = '*' + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + # CmdletsToExport = '*' -# Variables to export from this module -# VariablesToExport = '*' + # Variables to export from this module + # VariablesToExport = '*' -# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -# AliasesToExport = '*' + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + # AliasesToExport = '*' -# DSC resources to export from this module -# DscResourcesToExport = @() + # DSC resources to export from this module + # DscResourcesToExport = @() -# List of all modules packaged with this module -# ModuleList = @() + # List of all modules packaged with this module + # ModuleList = @() -# List of all files packaged with this module -# FileList = @() + # List of all files packaged with this module + # FileList = @() -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ - PSData = @{ + PSData = @{ - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('Graphviz', 'Veeam', 'Diagram', 'Documentation', 'Windows', 'PSEdition_Desktop', 'PSEdition_Core') + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('Graphviz', 'Veeam', 'Diagram', 'Documentation', 'Windows', 'PSEdition_Desktop', 'PSEdition_Core') - # A URL to the license for this module. - LicenseUri = 'https://raw.githubusercontent.com/rebelinux/Veeam.Diagrammer/dev/LICENSE' + # A URL to the license for this module. + LicenseUri = 'https://raw.githubusercontent.com/rebelinux/Veeam.Diagrammer/dev/LICENSE' - # A URL to the main website for this project. - ProjectUri = 'https://github.com/rebelinux/Veeam.Diagrammer' + # A URL to the main website for this project. + ProjectUri = 'https://github.com/rebelinux/Veeam.Diagrammer' - # A URL to an icon representing this module. - IconUri = 'https://raw.githubusercontent.com/rebelinux/Veeam.Diagrammer/dev/icons/verified_recoverability.png' + # A URL to an icon representing this module. + IconUri = 'https://raw.githubusercontent.com/rebelinux/Veeam.Diagrammer/dev/icons/verified_recoverability.png' - # ReleaseNotes of this module - ReleaseNotes = 'https://github.com/rebelinux/Veeam.Diagrammer/blob/master/CHANGELOG.md' + # ReleaseNotes of this module + ReleaseNotes = 'https://github.com/rebelinux/Veeam.Diagrammer/blob/master/CHANGELOG.md' - } # End of PSData hashtable + } # End of PSData hashtable -} # End of PrivateData hashtable + } # End of PrivateData hashtable -# HelpInfo URI of this module -# HelpInfoURI = '' + # HelpInfo URI of this module + # HelpInfoURI = '' -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' }