diff --git a/CHANGELOG.md b/CHANGELOG.md index 869bf67..8aac82f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ # :arrows_clockwise: Veeam VBR As Built Report Changelog -## [0.5.4] - 2022-09-16 +## [0.5.4] - 2022-09-17 ### Added - Added support for File Share Backup Job information - Added support for Backup Jobs GFS Policy information +- Added Simple Chart support + ### Fixed - Fixes [#49](https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/issues/49) diff --git a/Src/Private/Get-AbrVbrBackupRepository.ps1 b/Src/Private/Get-AbrVbrBackupRepository.ps1 index e988cb3..5ad0fc1 100644 --- a/Src/Private/Get-AbrVbrBackupRepository.ps1 +++ b/Src/Private/Get-AbrVbrBackupRepository.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupRepository { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -27,118 +27,166 @@ function Get-AbrVbrBackupRepository { process { try { if ((Get-VBRBackupRepository).count -gt 0) { - Section -Style Heading3 'Backup Repository' { - Paragraph "The following section provides Backup Repository summary information." - BlankLine - $OutObj = @() - try { - [Array]$BackupRepos = Get-VBRBackupRepository | Where-Object {$_.Type -ne "SanSnapshotOnly"} - [Array]$ScaleOuts = Get-VBRBackupRepository -ScaleOut - if ($ScaleOuts) { - $Extents = Get-VBRRepositoryExtent -Repository $ScaleOuts - $BackupRepos += $Extents.Repository - } - foreach ($BackupRepo in $BackupRepos) { - Write-PscriboMessage "Discovered $($BackupRepo.Name) Repository." - $PercentFree = 0 - if (@($($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes),$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes)) -ne 0) { - $UsedSpace = ($($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes-$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes))) - if ($UsedSpace -ne 0) { - $PercentFree = ($UsedSpace/$($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes)).tostring("P") - } + $OutObj = @() + try { + [Array]$BackupRepos = Get-VBRBackupRepository | Where-Object {$_.Type -ne "SanSnapshotOnly"} + [Array]$ScaleOuts = Get-VBRBackupRepository -ScaleOut + if ($ScaleOuts) { + $Extents = Get-VBRRepositoryExtent -Repository $ScaleOuts + $BackupRepos += $Extents.Repository + } + foreach ($BackupRepo in $BackupRepos) { + Write-PscriboMessage "Discovered $($BackupRepo.Name) Repository." + $PercentFree = 0 + if (@($($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes),$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes)) -ne 0) { + $UsedSpace = ($($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes-$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes))) + if ($UsedSpace -ne 0) { + $PercentFree = $([Math]::Round($UsedSpace/$($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes) * 100)) } - $inObj = [ordered] @{ - 'Name' = $BackupRepo.Name - 'Total Space' = "$($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes) Gb" - 'Free Space' = "$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes) Gb" - 'Space Used' = $PercentFree - 'Status' = Switch ($BackupRepo.IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {$BackupRepo.IsUnavailable} - } + } + $inObj = [ordered] @{ + 'Name' = $BackupRepo.Name + 'Total Space' = "$($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes) Gb" + 'Free Space' = "$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes) Gb" + 'Used Space %' = $PercentFree + 'Status' = Switch ($BackupRepo.IsUnavailable) { + 'False' {'Available'} + 'True' {'Unavailable'} + default {$BackupRepo.IsUnavailable} } - $OutObj += [pscustomobject]$inobj } + $OutObj += [pscustomobject]$inobj } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message - } + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } - if ($HealthCheck.Infrastructure.BR) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' - if ([int]([regex]::Matches($OutObj.'Space Used', "\d+(?!.*\d+)").value) -ge 75) { $OutObj | Set-Style -Style Warning -Property 'Space Used' } - if ([int]([regex]::Matches($OutObj.'Space Used', "\d+(?!.*\d+)").value) -ge 90) { $OutObj | Set-Style -Style Critical -Property 'Space Used' } + if ($HealthCheck.Infrastructure.BR) { + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + if ([int]([regex]::Matches($OutObj.'Space Used', "\d+(?!.*\d+)").value) -ge 75) { $OutObj | Set-Style -Style Warning -Property 'Space Used' } + if ([int]([regex]::Matches($OutObj.'Space Used', "\d+(?!.*\d+)").value) -ge 90) { $OutObj | Set-Style -Style Critical -Property 'Space Used' } + } + + $TableParams = @{ + Name = "Backup Repository - $VeeamBackupServer" + List = $false + ColumnWidths = 30, 18, 18, 19, 15 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $OutObj | Select-Object -Property 'Name','Used Space %' + + $exampleChart = New-Chart -Name BackupRepository -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru - $TableParams = @{ - Name = "Backup Repository - $VeeamBackupServer" - List = $false - ColumnWidths = 30, 18, 18, 19, 15 + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Name' + YField = 'Used Space %' + Palette = 'Green' + ColorPerDataPoint = $true } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Backup Repository' + TitleAlignment = 'Center' } - $OutObj | Sort-Object -Property 'Name' | Table @TableParams - #---------------------------------------------------------------------------------------------# - # Backup Repository Configuration Section # - #---------------------------------------------------------------------------------------------# - if ($InfoLevel.Infrastructure.BR -ge 2) { - try { - Section -Style Heading4 "Backup Repository Configuration" { - Paragraph "The following section provides a detailed information of the Veeam Backup Repository Configuration." - BlankLine - foreach ($BackupRepo in $BackupRepos) { - try { - Section -Style NOTOCHeading5 -ExcludeFromTOC $($BackupRepo.Name) { - $OutObj = @() - Write-PscriboMessage "Discovered $($BackupRepo.Name) Backup Repository." - $inObj = [ordered] @{ - 'Extent of ScaleOut Backup Repository' = (($ScaleOuts | Where-Object {($Extents | Where-Object {$_.name -eq $BackupRepo.Name}).ParentId -eq $_.Id}).Name) - 'Backup Proxy' = ($BackupRepo.Host).Name - 'Integration Type' = $BackupRepo.TypeDisplay - 'Path' = $BackupRepo.Path - 'Connection Type' = $BackupRepo.Type - 'Max Task Count' = $BackupRepo.Options.MaxTaskCount - 'Use Nfs On Mount Host' = ConvertTo-TextYN $BackupRepo.UseNfsOnMountHost - 'San Snapshot Only' = ConvertTo-TextYN $BackupRepo.IsSanSnapshotOnly - 'Dedup Storage' = ConvertTo-TextYN $BackupRepo.IsDedupStorage - 'Split Storages Per Vm' = ConvertTo-TextYN $BackupRepo.SplitStoragesPerVm - 'Immutability Supported' = ConvertTo-TextYN $BackupRepo.IsImmutabilitySupported - 'Immutability Enabled' = ConvertTo-TextYN $BackupRepo.GetImmutabilitySettings().IsEnabled - 'Immutability Interval' = $BackupRepo.GetImmutabilitySettings().IntervalDays - 'Version Of Creation' = $BackupRepo.VersionOfCreation - 'Has Backup Chain Length Limitation' = ConvertTo-TextYN $BackupRepo.HasBackupChainLengthLimitation - } - if ($null -eq $inObj.'Extent of ScaleOut Backup Repository') { - $inObj.Remove('Extent of ScaleOut Backup Repository') - } - $OutObj += [pscustomobject]$inobj + Add-ChartLegend @addChartLegendParams - if ($HealthCheck.Infrastructure.BR) { - $OutObj | Where-Object { $_.'Immutability Supported' -eq 'Yes' -and $_.'Immutability Enabled' -eq 'No' } | Set-Style -Style Warning -Property 'Immutability Enabled' - } + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'UsedSpace' + Text = 'Percentage of Used Space' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) + } + Add-ChartTitle @addChartTitleParams - $TableParams = @{ - Name = "Backup Repository - $($BackupRepo.Name)" - List = $true - ColumnWidths = 40, 60 - } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style Heading3 'Backup Repository' { + Paragraph "The following section provides Backup Repository summary information." + BlankLine + if ($chartFileItem) { + Image -Text 'Backup Repository - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Sort-Object -Property 'Name' | Table @TableParams + #---------------------------------------------------------------------------------------------# + # Backup Repository Configuration Section # + #---------------------------------------------------------------------------------------------# + if ($InfoLevel.Infrastructure.BR -ge 2) { + try { + Section -Style Heading4 "Backup Repository Configuration" { + Paragraph "The following section provides a detailed information of the Veeam Backup Repository Configuration." + BlankLine + foreach ($BackupRepo in $BackupRepos) { + try { + Section -Style NOTOCHeading5 -ExcludeFromTOC $($BackupRepo.Name) { + $OutObj = @() + Write-PscriboMessage "Discovered $($BackupRepo.Name) Backup Repository." + $inObj = [ordered] @{ + 'Extent of ScaleOut Backup Repository' = (($ScaleOuts | Where-Object {($Extents | Where-Object {$_.name -eq $BackupRepo.Name}).ParentId -eq $_.Id}).Name) + 'Backup Proxy' = ($BackupRepo.Host).Name + 'Integration Type' = $BackupRepo.TypeDisplay + 'Path' = $BackupRepo.Path + 'Connection Type' = $BackupRepo.Type + 'Max Task Count' = $BackupRepo.Options.MaxTaskCount + 'Use Nfs On Mount Host' = ConvertTo-TextYN $BackupRepo.UseNfsOnMountHost + 'San Snapshot Only' = ConvertTo-TextYN $BackupRepo.IsSanSnapshotOnly + 'Dedup Storage' = ConvertTo-TextYN $BackupRepo.IsDedupStorage + 'Split Storages Per Vm' = ConvertTo-TextYN $BackupRepo.SplitStoragesPerVm + 'Immutability Supported' = ConvertTo-TextYN $BackupRepo.IsImmutabilitySupported + 'Immutability Enabled' = ConvertTo-TextYN $BackupRepo.GetImmutabilitySettings().IsEnabled + 'Immutability Interval' = $BackupRepo.GetImmutabilitySettings().IntervalDays + 'Version Of Creation' = $BackupRepo.VersionOfCreation + 'Has Backup Chain Length Limitation' = ConvertTo-TextYN $BackupRepo.HasBackupChainLengthLimitation + } + if ($null -eq $inObj.'Extent of ScaleOut Backup Repository') { + $inObj.Remove('Extent of ScaleOut Backup Repository') + } + $OutObj += [pscustomobject]$inobj + + if ($HealthCheck.Infrastructure.BR) { + $OutObj | Where-Object { $_.'Immutability Supported' -eq 'Yes' -and $_.'Immutability Enabled' -eq 'No' } | Set-Style -Style Warning -Property 'Immutability Enabled' + } + + $TableParams = @{ + Name = "Backup Repository - $($BackupRepo.Name)" + List = $true + ColumnWidths = 40, 60 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } } } } diff --git a/Src/Private/Get-AbrVbrBackupjob.ps1 b/Src/Private/Get-AbrVbrBackupjob.ps1 index 4270e96..228f50c 100644 --- a/Src/Private/Get-AbrVbrBackupjob.ps1 +++ b/Src/Private/Get-AbrVbrBackupjob.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupjob { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -27,44 +27,103 @@ function Get-AbrVbrBackupjob { process { try { if ((Get-VBRJob -WarningAction SilentlyContinue).count -gt 0) { - Section -Style Heading3 'Backup Jobs' { - Paragraph "The following section list backup jobs created in Veeam Backup & Replication." - BlankLine - $OutObj = @() - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -ne 'Windows Agent Backup' -and $_.TypeToString -ne 'Hyper-V Replication' -and $_.TypeToString -ne 'VMware Replication'} - foreach ($Bkjob in $Bkjobs) { - try { - Write-PscriboMessage "Discovered $($Bkjob.Name) backup job." - $inObj = [ordered] @{ - 'Name' = $Bkjob.Name - 'Type' = $Bkjob.TypeToString - 'Status' = Switch ($Bkjob.IsScheduleEnabled) { - 'False' {'Disabled'} - 'True' {'Enabled'} - } - 'Latest Result' = $Bkjob.info.LatestStatus - 'Target Repository' = Switch ($Bkjob.info.TargetRepositoryId) { - '00000000-0000-0000-0000-000000000000' {$Bkjob.TargetDir} - {$Null -eq (Get-VBRBackupRepository | Where-Object {$_.Id -eq $Bkjob.info.TargetRepositoryId}).Name} {(Get-VBRBackupRepository -ScaleOut | Where-Object {$_.Id -eq $Bkjob.info.TargetRepositoryId}).Name} - default {(Get-VBRBackupRepository | Where-Object {$_.Id -eq $Bkjob.info.TargetRepositoryId}).Name} - } + $OutObj = @() + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -ne 'Windows Agent Backup' -and $_.TypeToString -ne 'Hyper-V Replication' -and $_.TypeToString -ne 'VMware Replication'} + foreach ($Bkjob in $Bkjobs) { + try { + Write-PscriboMessage "Discovered $($Bkjob.Name) backup job." + $inObj = [ordered] @{ + 'Name' = $Bkjob.Name + 'Type' = $Bkjob.TypeToString + 'Status' = Switch ($Bkjob.IsScheduleEnabled) { + 'False' {'Disabled'} + 'True' {'Enabled'} + } + 'Latest Result' = $Bkjob.info.LatestStatus + 'Target Repository' = Switch ($Bkjob.info.TargetRepositoryId) { + '00000000-0000-0000-0000-000000000000' {$Bkjob.TargetDir} + {$Null -eq (Get-VBRBackupRepository | Where-Object {$_.Id -eq $Bkjob.info.TargetRepositoryId}).Name} {(Get-VBRBackupRepository -ScaleOut | Where-Object {$_.Id -eq $Bkjob.info.TargetRepositoryId}).Name} + default {(Get-VBRBackupRepository | Where-Object {$_.Id -eq $Bkjob.info.TargetRepositoryId}).Name} } - $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message } + $OutObj += [pscustomobject]$inobj + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + } + + $TableParams = @{ + Name = "Backup Jobs - $VeeamBackupServer" + List = $false + ColumnWidths = 25, 20, 15, 15, 25 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $Alljobs = @() + if ($Bkjobs.info.LatestStatus) { + $Alljobs += $Bkjobs.info.LatestStatus + } + if ((Get-VBRTapeJob -ErrorAction SilentlyContinue).LastResult) { + $Alljobs += (Get-VBRTapeJob).LastResult + } + if ((Get-VSBJob -ErrorAction SilentlyContinue).GetLastResult()) { + $Alljobs += (Get-VSBJob).GetLastResult() } + $sampleData = $Alljobs | Group-Object + $exampleChart = New-Chart -Name BackupJobs -Width 600 -Height 400 - $TableParams = @{ - Name = "Backup Jobs - $VeeamBackupServer" - List = $false - ColumnWidths = 25, 20, 15, 15, 25 + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'BackupJobs' + AxisXTitle = 'Status' + AxisYTitle = 'Count' + NoAxisXMajorGridLines = $true + NoAxisYMajorGridLines = $true + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Name' + YField = 'Count' + Palette = 'Green' + ColorPerDataPoint = $true + } + $sampleData | Add-ColumnChartSeries @addChartSeriesParams + + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'BackupJob' + Text = 'Jobs Latest Result' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) + } + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + + if ($PassThru) + { + Write-Output -InputObject $chartFileItem + } + } + catch { + Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Account Security Assessment Table)" + } + if ($OutObj) { + if ($chartFileItem) { + Image -Text 'Backup Repository - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + Section -Style Heading3 'Backup Jobs' { + Paragraph "The following section list backup jobs created in Veeam Backup & Replication." + BlankLine + $OutObj | Sort-Object -Property Name |Table @TableParams } - $OutObj | Sort-Object -Property Name |Table @TableParams } } } diff --git a/Src/Private/Get-AbrVbrInfrastructureSummary.ps1 b/Src/Private/Get-AbrVbrInfrastructureSummary.ps1 index 50ba983..9ce9aa7 100644 --- a/Src/Private/Get-AbrVbrInfrastructureSummary.ps1 +++ b/Src/Private/Get-AbrVbrInfrastructureSummary.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrInfrastructureSummary { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,7 +26,6 @@ function Get-AbrVbrInfrastructureSummary { process { try { - Section -Style NOTOCHeading3 -ExcludeFromTOC 'Backup Infrastructure' { $OutObj = @() try { $BackupServers = (Get-VBRServer).Count @@ -48,16 +47,16 @@ function Get-AbrVbrInfrastructureSummary { Write-PscriboMessage -IsWarning $_.Exception.Message } $inObj = [ordered] @{ - 'Number of Backup Proxies' = $BackupProxies - 'Number of Managed Servers' = $BackupServers - 'Number of Backup Repositories' = $BackupRepo - 'Number of SOBR Repositories' = $SOBRRepo - 'Number of Object Repository' = $ObjectStorageRepo - 'Number of WAN Accelerator' = $WANAccels - 'Number of Cloud Service Providers' = $ServiceProviders - 'Number of SureBackup Application Group' = $SureBackupAGs - 'Number of SureBackup Virtual Lab' = $SureBackupVLs - 'Number of Locations' = $Locations + 'Backup Proxies' = $BackupProxies + 'Managed Servers' = $BackupServers + 'Backup Repositories' = $BackupRepo + 'SOBR Repositories' = $SOBRRepo + 'Object Repository' = $ObjectStorageRepo + 'WAN Accelerator' = $WANAccels + 'Cloud Service Providers' = $ServiceProviders + 'SureBackup Application Group' = $SureBackupAGs + 'SureBackup Virtual Lab' = $SureBackupVLs + 'Locations' = $Locations 'Instance Licenses (Total/Used)' = "$($InstanceLicenses.LicensedInstancesNumber)/$($InstanceLicenses.UsedInstancesNumber)" 'Socket Licenses (Total/Used)' = "$($SocketLicenses.LicensedSocketsNumber)/$($SocketLicenses.UsedSocketsNumber)" 'Capacity Licenses (Total/Used)' = "$($CapacityLicenses.LicensedCapacityTb)TB/$($CapacityLicenses.UsedCapacityTb)TB" @@ -69,14 +68,66 @@ function Get-AbrVbrInfrastructureSummary { } $TableParams = @{ - Name = "Backup Infrastructure Summary - $VeeamBackupServer" + Name = "Backup Infrastructure Inventory - $VeeamBackupServer" List = $true ColumnWidths = 50, 50 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $OutObj | Table @TableParams + try { + $inObj.Remove('Instance Licenses (Total/Used)') + $inObj.Remove('Socket Licenses (Total/Used)') + $inObj.Remove('Capacity Licenses (Total/Used)') + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name BackupInfrastructure -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true + } + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Infrastructure' + TitleAlignment = 'Center' + } + Add-ChartLegend @addChartLegendParams + + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) + } + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading3 -ExcludeFromTOC 'Backup Infrastructure Inventory' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Backup Infrastructure - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams + } } } catch { diff --git a/Src/Private/Get-AbrVbrInstalledLicense.ps1 b/Src/Private/Get-AbrVbrInstalledLicense.ps1 index 5603168..030378a 100644 --- a/Src/Private/Get-AbrVbrInstalledLicense.ps1 +++ b/Src/Private/Get-AbrVbrInstalledLicense.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrInstalledLicense { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -85,72 +85,120 @@ function Get-AbrVbrInstalledLicense { #---------------------------------------------------------------------------------------------# try { $Licenses = Get-VBRInstalledLicense | Select-Object -ExpandProperty InstanceLicenseSummary - if ($Licenses) { - Section -Style NOTOCHeading5 -ExcludeFromTOC 'Instance License Usage' { - $OutObj = @() - try { - foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.LicensedInstancesNumber) Instance licenses." - $inObj = [ordered] @{ - 'Instances Capacity' = $License.LicensedInstancesNumber - 'Used Instances' = $License.UsedInstancesNumber - 'New Instances' = $License.NewInstancesNumber - 'Rental Instances' = $License.RentalInstancesNumber - } - $OutObj += [pscustomobject]$inobj + if ($Licenses.LicensedInstancesNumber -gt 0) { + $OutObj = @() + try { + foreach ($License in $Licenses) { + Write-PscriboMessage "Discovered $($Licenses.LicensedInstancesNumber) Instance licenses." + $inObj = [ordered] @{ + 'Instances Capacity' = $License.LicensedInstancesNumber + 'Used Instances' = $License.UsedInstancesNumber + 'New Instances' = $License.NewInstancesNumber + 'Rental Instances' = $License.RentalInstancesNumber } + $OutObj += [pscustomobject]$inobj + } + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + + $TableParams = @{ + Name = "Instance License Usage - $VeeamBackupServer" + List = $false + ColumnWidths = 25, 25, 25, 25 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name InstanceLicenseUsage -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true + } + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Category' + TitleAlignment = 'Center' + } + Add-ChartLegend @addChartLegendParams + + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message - } - - $TableParams = @{ - Name = "Instance License Usage - $VeeamBackupServer" - List = $false - ColumnWidths = 25, 25, 25, 25 - } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" - } - $OutObj | Table @TableParams - #---------------------------------------------------------------------------------------------# - # Per Instance Section # - #---------------------------------------------------------------------------------------------# - try { - $Licenses = (Get-VBRInstalledLicense | Select-Object -ExpandProperty InstanceLicenseSummary).Object - if ($Licenses) { - Section -Style NOTOCHeading5 -ExcludeFromTOC 'Per Instance Type License Usage' { - $OutObj = @() - try { - foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.Type) Instance licenses." - $inObj = [ordered] @{ - 'Type' = $License.Type - 'Count' = $License.Count - 'Multiplier' = $License.Multiplier - 'Used Instances' = $License.UsedInstancesNumber + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading5 -ExcludeFromTOC 'Instance License Usage' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Instance License Usage - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams + #---------------------------------------------------------------------------------------------# + # Per Instance Section # + #---------------------------------------------------------------------------------------------# + try { + $Licenses = (Get-VBRInstalledLicense | Select-Object -ExpandProperty InstanceLicenseSummary).Object + if ($Licenses) { + Section -Style NOTOCHeading5 -ExcludeFromTOC 'Per Instance Type License Usage' { + $OutObj = @() + try { + foreach ($License in $Licenses) { + Write-PscriboMessage "Discovered $($Licenses.Type) Instance licenses." + $inObj = [ordered] @{ + 'Type' = $License.Type + 'Count' = $License.Count + 'Multiplier' = $License.Multiplier + 'Used Instances' = $License.UsedInstancesNumber + } + $OutObj += [pscustomobject]$inobj } - $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message - } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } - $TableParams = @{ - Name = "Per Instance Type - $VeeamBackupServer" - List = $false - ColumnWidths = 25, 25, 25, 25 - } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + $TableParams = @{ + Name = "Per Instance Type - $VeeamBackupServer" + List = $false + ColumnWidths = 25, 25, 25, 25 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } } } } @@ -163,33 +211,81 @@ function Get-AbrVbrInstalledLicense { #---------------------------------------------------------------------------------------------# try { $Licenses = Get-VBRInstalledLicense | Select-Object -ExpandProperty SocketLicenseSummary - if ($Licenses) { - Section -Style NOTOCHeading5 -ExcludeFromTOC 'CPU Socket License Usage' { - $OutObj = @() - try { - foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.LicensedSocketsNumber) CPU Socket licenses." - $inObj = [ordered] @{ - 'Licensed Sockets' = $License.LicensedSocketsNumber - 'Used Sockets Licenses' = $License.UsedSocketsNumber - 'Remaining Sockets Licenses' = $License.RemainingSocketsNumber - } - $OutObj += [pscustomobject]$inobj + if ($Licenses.LicensedSocketsNumber -gt 0) { + $OutObj = @() + try { + foreach ($License in $Licenses) { + Write-PscriboMessage "Discovered $($Licenses.LicensedSocketsNumber) CPU Socket licenses." + $inObj = [ordered] @{ + 'Licensed Sockets' = $License.LicensedSocketsNumber + 'Used Sockets Licenses' = $License.UsedSocketsNumber + 'Remaining Sockets Licenses' = $License.RemainingSocketsNumber } + $OutObj += [pscustomobject]$inobj } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + + $TableParams = @{ + Name = "CPU Socket Usage - $VeeamBackupServer" + List = $false + ColumnWidths = 33, 33, 34 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name CPUSocketUsage -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true } + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru - $TableParams = @{ - Name = "CPU Socket Usage - $VeeamBackupServer" - List = $false - ColumnWidths = 33, 33, 34 + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Category' + TitleAlignment = 'Center' } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + Add-ChartLegend @addChartLegendParams + + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) + } + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading5 -ExcludeFromTOC 'CPU Socket License Usage' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'CPU Socket License Usage - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } } @@ -201,32 +297,80 @@ function Get-AbrVbrInstalledLicense { #---------------------------------------------------------------------------------------------# try { $Licenses = Get-VBRInstalledLicense | Select-Object -ExpandProperty CapacityLicenseSummary - if ($Licenses) { - Section -Style NOTOCHeading5 -ExcludeFromTOC 'Capacity License Usage' { - $OutObj = @() - try { - foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.LicensedCapacityTb) Capacity licenses." - $inObj = [ordered] @{ - 'Licensed Capacity in Tb' = $License.LicensedCapacityTb - 'Used Capacity in Tb' = $License.UsedCapacityTb - } - $OutObj += [pscustomobject]$inobj + if ($Licenses.LicensedCapacityTb -gt 0) { + $OutObj = @() + try { + foreach ($License in $Licenses) { + Write-PscriboMessage "Discovered $($Licenses.LicensedCapacityTb) Capacity licenses." + $inObj = [ordered] @{ + 'Licensed Capacity in TB' = $License.LicensedCapacityTb + 'Used Capacity in TB' = $License.UsedCapacityTb } + $OutObj += [pscustomobject]$inobj } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + + $TableParams = @{ + Name = "Capacity License Usage - $VeeamBackupServer" + List = $false + ColumnWidths = 50, 50 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name CapacityLicenseUsage -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true + } + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Category' + TitleAlignment = 'Center' } + Add-ChartLegend @addChartLegendParams - $TableParams = @{ - Name = "Capacity License Usage - $VeeamBackupServer" - List = $false - ColumnWidths = 50, 50 + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading5 -ExcludeFromTOC 'Capacity License Usage' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Capacity License Usage - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } } diff --git a/Src/Private/Get-AbrVbrInventorySummary.ps1 b/Src/Private/Get-AbrVbrInventorySummary.ps1 index ca09509..7c688f2 100644 --- a/Src/Private/Get-AbrVbrInventorySummary.ps1 +++ b/Src/Private/Get-AbrVbrInventorySummary.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrInventorySummary { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,38 +26,86 @@ function Get-AbrVbrInventorySummary { process { try { - Section -Style NOTOCHeading3 -ExcludeFromTOC 'Inventory' { - $OutObj = @() - try { - $vCenter = Get-VBRServer | Where-Object {$_.Type -eq 'VC'} - $ESXi = Get-VBRServer | Where-Object {$_.Type -eq 'ESXi'} - $HvCluster = Get-VBRServer | Where-Object {$_.Type -eq 'HvCluster'} - $HvServer = Get-VBRServer | Where-Object {$_.Type -eq 'HvServer'} - $ProtectionGroups = Get-VBRProtectionGroup - $Shares = Get-VBRNASServer - $inObj = [ordered] @{ - 'Number of vCenter Servers' = $vCenter.Count - 'Number of ESXi Servers' = $ESXi.Count - 'Number of Hyper-V Clusters' = $HvCluster.Count - 'Number of Hyper-V Servers' = $HvServer.Count - 'Number of Protection Groups' = $ProtectionGroups.Count - 'Number of File Shares' = $Shares.Count - } - $OutObj += [pscustomobject]$inobj + $OutObj = @() + try { + $vCenter = Get-VBRServer | Where-Object {$_.Type -eq 'VC'} + $ESXi = Get-VBRServer | Where-Object {$_.Type -eq 'ESXi'} + $HvCluster = Get-VBRServer | Where-Object {$_.Type -eq 'HvCluster'} + $HvServer = Get-VBRServer | Where-Object {$_.Type -eq 'HvServer'} + $ProtectionGroups = Get-VBRProtectionGroup + $Shares = Get-VBRNASServer + $inObj = [ordered] @{ + 'vCenter Servers' = $vCenter.Count + 'ESXi Servers' = $ESXi.Count + 'Hyper-V Clusters' = $HvCluster.Count + 'Hyper-V Servers' = $HvServer.Count + 'Protection Groups' = $ProtectionGroups.Count + 'File Shares' = $Shares.Count + } + $OutObj += [pscustomobject]$inobj + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + + $TableParams = @{ + Name = "Inventory Summary - $VeeamBackupServer" + List = $true + ColumnWidths = 50, 50 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name Inventory -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Infrastructure' + TitleAlignment = 'Center' } + Add-ChartLegend @addChartLegendParams - $TableParams = @{ - Name = "Inventory Summary - $VeeamBackupServer" - List = $true - ColumnWidths = 50, 50 + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading3 -ExcludeFromTOC 'Inventory' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Inventory - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } catch { diff --git a/Src/Private/Get-AbrVbrReplInfraSummary.ps1 b/Src/Private/Get-AbrVbrReplInfraSummary.ps1 index 66008be..60e99a3 100644 --- a/Src/Private/Get-AbrVbrReplInfraSummary.ps1 +++ b/Src/Private/Get-AbrVbrReplInfraSummary.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrReplInfraSummary { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,25 +26,73 @@ function Get-AbrVbrReplInfraSummary { process { try { - Section -Style NOTOCHeading3 -ExcludeFromTOC 'Replication' { - $OutObj = @() - $Replicas = Get-VBRReplica - $FailOverPlans = Get-VBRFailoverPlan - $inObj = [ordered] @{ - 'Number of Replicas' = $Replicas.Count - 'Number of Failover Plans' = $FailOverPlans.Count + $OutObj = @() + $Replicas = Get-VBRReplica + $FailOverPlans = Get-VBRFailoverPlan + $inObj = [ordered] @{ + 'Replicas' = $Replicas.Count + 'Failover Plans' = $FailOverPlans.Count + } + $OutObj += [pscustomobject]$inobj + + $TableParams = @{ + Name = "Replication Inventory - $VeeamBackupServer" + List = $true + ColumnWidths = 50, 50 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name ReplicationInventory -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' } - $OutObj += [pscustomobject]$inobj + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru - $TableParams = @{ - Name = "Replication Summary - $VeeamBackupServer" - List = $true - ColumnWidths = 50, 50 + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Infrastructure' + TitleAlignment = 'Center' + } + Add-ChartLegend @addChartLegendParams + + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) + } + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading3 -ExcludeFromTOC 'Replication Inventory' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Replication Inventory - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } catch { diff --git a/Src/Private/Get-AbrVbrStorageInfraSummary.ps1 b/Src/Private/Get-AbrVbrStorageInfraSummary.ps1 index bd948c1..72feab7 100644 --- a/Src/Private/Get-AbrVbrStorageInfraSummary.ps1 +++ b/Src/Private/Get-AbrVbrStorageInfraSummary.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrStorageInfraSummary { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,34 +26,82 @@ function Get-AbrVbrStorageInfraSummary { process { try { - Section -Style NOTOCHeading3 -ExcludeFromTOC 'Storage Infrastructure' { - $OutObj = @() - try { - $OntapHosts = Get-NetAppHost - $OntapVols = Get-NetAppVolume - $IsilonHosts = Get-VBRIsilonHost - $IsilonVols = Get-VBRIsilonVolume - $inObj = [ordered] @{ - 'Number of NetApp Ontap Storage' = $OntapHosts.Count - 'Number of NetApp Ontap Volumes' = $OntapHosts.Count - 'Number of Dell Isilon Storage' = $IsilonHosts.Count - 'Number of Dell Isilon Volumes' = $IsilonVols.Count - } - $OutObj += [pscustomobject]$inobj + $OutObj = @() + try { + $OntapHosts = Get-NetAppHost + $OntapVols = Get-NetAppVolume + $IsilonHosts = Get-VBRIsilonHost + $IsilonVols = Get-VBRIsilonVolume + $inObj = [ordered] @{ + 'NetApp Ontap Storage' = $OntapHosts.Count + 'NetApp Ontap Volumes' = $OntapHosts.Count + 'Dell Isilon Storage' = $IsilonHosts.Count + 'Dell Isilon Volumes' = $IsilonVols.Count + } + $OutObj += [pscustomobject]$inobj + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + + $TableParams = @{ + Name = "Storage Infrastructure Inventory - $VeeamBackupServer" + List = $true + ColumnWidths = 50, 50 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name StorageInfrastructure -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Infrastructure' + TitleAlignment = 'Center' } + Add-ChartLegend @addChartLegendParams - $TableParams = @{ - Name = "Storage Infrastructure Summary - $VeeamBackupServer" - List = $true - ColumnWidths = 50, 50 + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading3 -ExcludeFromTOC 'Storage Infrastructure Inventory' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Storage Infrastructure Inventory - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } catch { diff --git a/Src/Private/Get-AbrVbrTapeInfraSummary.ps1 b/Src/Private/Get-AbrVbrTapeInfraSummary.ps1 index c1553c5..c007213 100644 --- a/Src/Private/Get-AbrVbrTapeInfraSummary.ps1 +++ b/Src/Private/Get-AbrVbrTapeInfraSummary.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrTapeInfraSummary { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,38 +26,86 @@ function Get-AbrVbrTapeInfraSummary { process { try { - Section -Style NOTOCHeading3 -ExcludeFromTOC 'Tape Infrastructure' { - $OutObj = @() - try { - $TapeServer = Get-VBRTapeServer - $TapeLibrary = Get-VBRTapeLibrary - $TapeMediaPool = Get-VBRTapeMediaPool - $TapeVault = Get-VBRTapeVault - $TapeDrive = Get-VBRTapeDrive - $TapeMedium = Get-VBRTapeMedium - $inObj = [ordered] @{ - 'Number of Tape Servers' = $TapeServer.Count - 'Number of Tape Library' = $TapeLibrary.Count - 'Number of Tape MediaPool' = $TapeMediaPool.Count - 'Number of Tape Vault' = $TapeVault.Count - 'Number of Tape Drives' = $TapeDrive.Count - 'Number of Tape Medium' = $TapeMedium.Count - } - $OutObj += [pscustomobject]$inobj + $OutObj = @() + try { + $TapeServer = Get-VBRTapeServer + $TapeLibrary = Get-VBRTapeLibrary + $TapeMediaPool = Get-VBRTapeMediaPool + $TapeVault = Get-VBRTapeVault + $TapeDrive = Get-VBRTapeDrive + $TapeMedium = Get-VBRTapeMedium + $inObj = [ordered] @{ + 'Tape Servers' = $TapeServer.Count + 'Tape Library' = $TapeLibrary.Count + 'Tape MediaPool' = $TapeMediaPool.Count + 'Tape Vault' = $TapeVault.Count + 'Tape Drives' = $TapeDrive.Count + 'Tape Medium' = $TapeMedium.Count + } + $OutObj += [pscustomobject]$inobj + } + catch { + Write-PscriboMessage -IsWarning $_.Exception.Message + } + + $TableParams = @{ + Name = "Tape Infrastructure Inventory - $VeeamBackupServer" + List = $true + ColumnWidths = 50, 50 + } + if ($Report.ShowTableCaptions) { + $TableParams['Caption'] = "- $($TableParams.Name)" + } + try { + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + + $exampleChart = New-Chart -Name TapeInfrastructure -Width 600 -Height 400 + + $addChartAreaParams = @{ + Chart = $exampleChart + Name = 'exampleChartArea' + } + $exampleChartArea = Add-ChartArea @addChartAreaParams -PassThru + + $addChartSeriesParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = 'exampleChartSeries' + XField = 'Category' + YField = 'Value' + Palette = 'Green' + ColorPerDataPoint = $true } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + $exampleChartSeries = $sampleData | Add-PieChartSeries @addChartSeriesParams -PassThru + + $addChartLegendParams = @{ + Chart = $exampleChart + Name = 'Infrastructure' + TitleAlignment = 'Center' } + Add-ChartLegend @addChartLegendParams - $TableParams = @{ - Name = "Tape Infrastructure Summary - $VeeamBackupServer" - List = $true - ColumnWidths = 50, 50 + $addChartTitleParams = @{ + Chart = $exampleChart + ChartArea = $exampleChartArea + Name = ' ' + Text = ' ' + Font = New-Object -TypeName 'System.Drawing.Font' -ArgumentList @('Arial', '12', [System.Drawing.FontStyle]::Bold) } - if ($Report.ShowTableCaptions) { - $TableParams['Caption'] = "- $($TableParams.Name)" + Add-ChartTitle @addChartTitleParams + + $chartFileItem = Export-Chart -Chart $exampleChart -Path (Get-Location).Path -Format "PNG" -PassThru + } + catch { + Write-PscriboMessage -IsWarning $($_.Exception.Message) + } + if ($OutObj) { + Section -Style NOTOCHeading3 -ExcludeFromTOC 'Tape Infrastructure' { + if ($chartFileItem -and ($inObj.Values | Measure-Object -Sum).Sum -ne 0) { + Image -Text 'Tape Infrastructure - Diagram' -Align 'Center' -Percent 100 -Path $chartFileItem + } + $OutObj | Table @TableParams } - $OutObj | Table @TableParams } } catch { diff --git a/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 b/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 index bf5afe3..a990fb7 100644 --- a/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 @@ -5,7 +5,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.3 + Version: 0.5.4 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,6 +26,17 @@ function Invoke-AsBuiltReport.Veeam.VBR { Write-PScriboMessage -IsWarning "Documentation: https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR" Write-PScriboMessage -IsWarning "Issues or bug reporting: https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/issues" + $InstalledVersion = Get-Module -ListAvailable -Name AsBuiltReport.Veeam.VBR -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Version + + if ($InstalledVersion) { + Write-PScriboMessage -IsWarning "Installed AsBuiltReport.Veeam.VBR Version: $($InstalledVersion.ToString())" + $MostCurrentVersion = Find-Module -Name AsBuiltReport.Veeam.VBR -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Version + if ($MostCurrentVersion -and ($MostCurrentVersion -gt $InstalledVersion)) { + Write-PScriboMessage -IsWarning "New Update: AsBuiltReport.Veeam.VBR Version: $($MostCurrentVersion.ToString())" + Write-PScriboMessage -IsWarning "To Update run: Update-Module -Name AsBuiltReport.Veeam.VBR -Force" + } + } + # Import Report Configuration $Report = $ReportConfig.Report $InfoLevel = $ReportConfig.InfoLevel