Skip to content

Commit

Permalink
Merge pull request #55 from AsBuiltReport/dev
Browse files Browse the repository at this point in the history
v0.5.4 public release
  • Loading branch information
rebelinux authored Sep 18, 2022
2 parents 227b6fc + 644126a commit ca0d7ec
Show file tree
Hide file tree
Showing 21 changed files with 1,414 additions and 353 deletions.
2 changes: 1 addition & 1 deletion AsBuiltReport.Veeam.VBR.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'AsBuiltReport.Veeam.VBR.psm1'

# Version number of this module.
ModuleVersion = '0.5.3'
ModuleVersion = '0.5.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
1 change: 1 addition & 0 deletions AsBuiltreport.Veeam.VBR.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"Tape": 1,
"Surebackup": 1,
"Agent": 1,
"FileShare": 1,
"Replication": 1
}
},
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# :arrows_clockwise: Veeam VBR As Built Report Changelog

## [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)
- Fixes [#50](https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/issues/50)

## [0.5.3] - 2022-08-21

### Changed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ The table below outlines the default and maximum **InfoLevel** settings for each
| Tape | 1 | 2 |
| Surebackup | 1 | 2 |
| Agent | 1 | 2 |
| FileShare | 1 | 2 |
| Replication | 1 | 2 |

The table below outlines the default and maximum **InfoLevel** settings for each Replication section.
Expand Down
240 changes: 144 additions & 96 deletions Src/Private/Get-AbrVbrBackupRepository.ps1

Large diffs are not rendered by default.

125 changes: 92 additions & 33 deletions Src/Private/Get-AbrVbrBackupjob.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
}
Expand Down
20 changes: 19 additions & 1 deletion Src/Private/Get-AbrVbrBackupjobHyperV.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,24 @@ function Get-AbrVbrBackupjobHyperV {
'Transform To Syntethic Days' = $Bkjob.Options.BackupTargetOptions.TransformToSyntethicDays


}
if ($Bkjob.Options.GfsPolicy.IsEnabled) {
$inObj.add('Keep certain full backup longer for archival purposes (GFS)',(ConvertTo-TextYN $Bkjob.Options.GfsPolicy.IsEnabled))
if (-Not $Bkjob.Options.GfsPolicy.Weekly.IsEnabled) {
$inObj.add('Keep Weekly full backup', ('Disabled'))
} else {
$inObj.add('Keep Weekly full backup for', ("$($Bkjob.Options.GfsPolicy.Weekly.KeepBackupsForNumberOfWeeks) weeks,`r`nIf multiple backup exist use the one from: $($Bkjob.Options.GfsPolicy.Weekly.DesiredTime)"))
}
if (-Not $Bkjob.Options.GfsPolicy.Monthly.IsEnabled) {
$inObj.add('Keep Monthly full backup', ('Disabled'))
} else {
$inObj.add('Keep Monthly full backup for', ("$($Bkjob.Options.GfsPolicy.Monthly.KeepBackupsForNumberOfMonths) months,`r`nUse weekly full backup from the following week of the month: $($Bkjob.Options.GfsPolicy.Monthly.DesiredTime)"))
}
if (-Not $Bkjob.Options.GfsPolicy.Yearly.IsEnabled) {
$inObj.add('Keep Yearly full backup', ('Disabled'))
} else {
$inObj.add('Keep Yearly full backup for', ("$($Bkjob.Options.GfsPolicy.Yearly.KeepBackupsForNumberOfYears) years,`r`nUse monthly full backup from the following month: $($Bkjob.Options.GfsPolicy.Yearly.DesiredTime)"))
}
}
$OutObj = [pscustomobject]$inobj

Expand Down Expand Up @@ -568,7 +586,7 @@ function Get-AbrVbrBackupjobHyperV {
Write-PscriboMessage "Discovered $($Bkjob.Name) guest processing."
$inObj = [ordered] @{
'Name' = $VSSObj.Name
'Enabled' = ConvertTo-TextYN $Bkjob.VssOptions.Enabled
'Enabled' = ConvertTo-TextYN $VSSObj.VssOptions.Enabled
'Resource Type' = ($Bkjob.GetHvOijs() | Where-Object {$_.Name -eq $VSSObj.Name -and ($_.Type -eq "Include" -or $_.Type -eq "VssChild")}).TypeDisplayName
'Ignore Errors' = ConvertTo-TextYN $VSSObj.VssOptions.IgnoreErrors
'Guest Proxy Auto Detect' = ConvertTo-TextYN $VSSObj.VssOptions.GuestProxyAutoDetect
Expand Down
22 changes: 20 additions & 2 deletions Src/Private/Get-AbrVbrBackupjobVMware.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,24 @@ function Get-AbrVbrBackupjobVMware {
'Transform To Syntethic Days' = $Bkjob.Options.BackupTargetOptions.TransformToSyntethicDays


}
if ($Bkjob.Options.GfsPolicy.IsEnabled) {
$inObj.add('Keep certain full backup longer for archival purposes (GFS)',(ConvertTo-TextYN $Bkjob.Options.GfsPolicy.IsEnabled))
if (-Not $Bkjob.Options.GfsPolicy.Weekly.IsEnabled) {
$inObj.add('Keep Weekly full backup', ('Disabled'))
} else {
$inObj.add('Keep Weekly full backup for', ("$($Bkjob.Options.GfsPolicy.Weekly.KeepBackupsForNumberOfWeeks) weeks,`r`nIf multiple backup exist use the one from: $($Bkjob.Options.GfsPolicy.Weekly.DesiredTime)"))
}
if (-Not $Bkjob.Options.GfsPolicy.Monthly.IsEnabled) {
$inObj.add('Keep Monthly full backup', ('Disabled'))
} else {
$inObj.add('Keep Monthly full backup for', ("$($Bkjob.Options.GfsPolicy.Monthly.KeepBackupsForNumberOfMonths) months,`r`nUse weekly full backup from the following week of the month: $($Bkjob.Options.GfsPolicy.Monthly.DesiredTime)"))
}
if (-Not $Bkjob.Options.GfsPolicy.Yearly.IsEnabled) {
$inObj.add('Keep Yearly full backup', ('Disabled'))
} else {
$inObj.add('Keep Yearly full backup for', ("$($Bkjob.Options.GfsPolicy.Yearly.KeepBackupsForNumberOfYears) years,`r`nUse monthly full backup from the following month: $($Bkjob.Options.GfsPolicy.Yearly.DesiredTime)"))
}
}
$OutObj = [pscustomobject]$inobj

Expand Down Expand Up @@ -613,7 +631,7 @@ function Get-AbrVbrBackupjobVMware {
Write-PscriboMessage "Discovered $($Bkjob.Name) guest processing."
$inObj = [ordered] @{
'Name' = $VSSObj.Name
'Enabled' = ConvertTo-TextYN $Bkjob.VssOptions.Enabled
'Enabled' = ConvertTo-TextYN $VSSObj.VssOptions.Enabled
'Resource Type' = ($Bkjob.GetViOijs() | Where-Object {$_.Name -eq $VSSObj.Name -and ($_.Type -eq "Include" -or $_.Type -eq "VssChild")}).TypeDisplayName
'Ignore Errors' = ConvertTo-TextYN $VSSObj.VssOptions.IgnoreErrors
'Guest Proxy Auto Detect' = ConvertTo-TextYN $VSSObj.VssOptions.GuestProxyAutoDetect
Expand Down Expand Up @@ -774,4 +792,4 @@ function Get-AbrVbrBackupjobVMware {
}
end {}

}
}
76 changes: 76 additions & 0 deletions Src/Private/Get-AbrVbrFileShareBackupjob.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

function Get-AbrVbrFileShareBackupjob {
<#
.SYNOPSIS
Used by As Built Report to returns file share jobs created in Veeam Backup & Replication.
.DESCRIPTION
Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.4
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Credits: Iain Brighton (@iainbrighton) - PScribo module
.LINK
https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR
#>
[CmdletBinding()]
param (

)

begin {
Write-PscriboMessage "Discovering Veeam VBR File Share Backup jobs information from $System."
}

process {
try {
$FSBkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.TypeToString -like 'File Backup'}
if ($FSBkjobs.count -gt 0) {
Section -Style Heading3 'File Share Backup Jobs' {
Paragraph "The following section list file share backup jobs created in Veeam Backup & Replication."
BlankLine
$OutObj = @()
foreach ($FSBkjob in $FSBkjobs) {
try {
Write-PscriboMessage "Discovered $($FSBkjob.Name) file share."
$inObj = [ordered] @{
'Name' = $FSBkjob.Name
'Type' = $FSBkjob.TypeToString
'Status' = Switch ($FSBkjob.IsScheduleEnabled) {
'False' {'Disabled'}
'True' {'Enabled'}
}
'Latest Result' = $FSBkjob.info.LatestStatus
'Last Run' = Switch ($FSBkjob.FindLastSession()) {
$Null {'Unknown'}
default {$FSBkjob.FindLastSession().EndTimeUTC}
}
}
$OutObj += [pscustomobject]$inobj
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
}

$TableParams = @{
Name = "File Share Backup Jobs - $VeeamBackupServer"
List = $false
ColumnWidths = 25, 20, 15, 15, 25
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$OutObj | Sort-Object -Property 'Name' |Table @TableParams
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
}
end {}

}
Loading

0 comments on commit ca0d7ec

Please sign in to comment.