diff --git a/AsBuiltReport.Veeam.VBR.psd1 b/AsBuiltReport.Veeam.VBR.psd1 index 5ffe4c7..98a78c7 100644 --- a/AsBuiltReport.Veeam.VBR.psd1 +++ b/AsBuiltReport.Veeam.VBR.psd1 @@ -8,130 +8,130 @@ @{ -# Script module or binary module file associated with this manifest. -RootModule = 'AsBuiltReport.Veeam.VBR.psm1' + # Script module or binary module file associated with this manifest. + RootModule = 'AsBuiltReport.Veeam.VBR.psm1' -# Version number of this module. -ModuleVersion = '0.8.5' + # Version number of this module. + ModuleVersion = '0.8.5' -# Supported PSEditions -# CompatiblePSEditions = @() + # Supported PSEditions + # CompatiblePSEditions = @() -# ID used to uniquely identify this module -GUID = '7f25f32e-70cb-49e6-a71b-eec42e0595c1' + # ID used to uniquely identify this module + GUID = '7f25f32e-70cb-49e6-a71b-eec42e0595c1' -# Author of this module -Author = 'Jonathan Colon' + # Author of this module + Author = 'Jonathan Colon' -# Company or vendor of this module -#CompanyName = 'Unknown' + # Company or vendor of this module + #CompanyName = 'Unknown' -# 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 as built report on the configuration of Veeam VBR.' + # Description of the functionality provided by this module + Description = 'A PowerShell module to generate an as built report on the configuration of Veeam VBR.' -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.1' + # Minimum version of the Windows PowerShell engine required by this module + PowerShellVersion = '5.1' -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' + # Minimum version of the Windows 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 + # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( - @{ - ModuleName = 'AsBuiltReport.Core'; - ModuleVersion = '1.3.0' - } - @{ - ModuleName = 'PScriboCharts'; - ModuleVersion = '0.9.0' - } - @{ - ModuleName = 'Veeam.Diagrammer'; - ModuleVersion = '0.5.8' - } -) + RequiredModules = @( + @{ + ModuleName = 'AsBuiltReport.Core'; + ModuleVersion = '1.3.0' + } + @{ + ModuleName = 'PScriboCharts'; + ModuleVersion = '0.9.0' + } + @{ + ModuleName = 'Veeam.Diagrammer'; + ModuleVersion = '0.5.8' + } + ) -# 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 = @('Invoke-AsBuiltReport.Veeam.VBR') + # 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 = @('Invoke-AsBuiltReport.Veeam.VBR') -# 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 = @('AsBuiltReport', 'Report', 'Veeam', 'VBR', 'Documentation', 'PScribo', 'Windows', 'PSEdition_Desktop', 'PSEdition_Core') + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('AsBuiltReport', 'Report', 'Veeam', 'VBR', 'Documentation', 'PScribo', 'Windows', 'PSEdition_Desktop', 'PSEdition_Core') - # A URL to the license for this module. - LicenseUri = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/master/LICENSE' + # A URL to the license for this module. + LicenseUri = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/master/LICENSE' - # A URL to the main website for this project. - ProjectUri = 'https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR' + # A URL to the main website for this project. + ProjectUri = 'https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR' - # A URL to an icon representing this module. - IconUri = 'https://github.com/AsBuiltReport.png' + # A URL to an icon representing this module. + IconUri = 'https://github.com/AsBuiltReport.png' - # ReleaseNotes of this module - ReleaseNotes = 'https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/blob/master/CHANGELOG.md' + # ReleaseNotes of this module + ReleaseNotes = 'https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR/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 = '' } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c5694f..014bce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Removed Graphviz install check code. (No need to manually install Graphviz) +- Code Cleanup ### Fixed diff --git a/Src/Private/Get-AbrVbrAgentBackupjob.ps1 b/Src/Private/Get-AbrVbrAgentBackupjob.ps1 index c6270ba..3848a7d 100644 --- a/Src/Private/Get-AbrVbrAgentBackupjob.ps1 +++ b/Src/Private/Get-AbrVbrAgentBackupjob.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrAgentBackupjob { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrAgentBackupjob { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Agent Backup jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR Agent Backup jobs information from $System." } process { @@ -34,7 +34,7 @@ function Get-AbrVbrAgentBackupjob { $OutObj = @() foreach ($ABkjob in $ABkjobs) { try { - Write-PscriboMessage "Discovered $($ABkjob.Name) location." + Write-PScriboMessage "Discovered $($ABkjob.Name) location." $inObj = [ordered] @{ 'Name' = $ABkjob.Name 'Type' = $ABkjob.Type @@ -42,9 +42,8 @@ function Get-AbrVbrAgentBackupjob { 'Backup Object' = $ABkjob.BackupObject } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs $($ABkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs $($ABkjob.Name) Section: $($_.Exception.Message)" } } @@ -56,12 +55,11 @@ function Get-AbrVbrAgentBackupjob { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $OutObj | Sort-Object -Property 'Name' |Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrAgentBackupjobConf.ps1 b/Src/Private/Get-AbrVbrAgentBackupjobConf.ps1 index f9b743f..12ae7b5 100644 --- a/Src/Private/Get-AbrVbrAgentBackupjobConf.ps1 +++ b/Src/Private/Get-AbrVbrAgentBackupjobConf.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrAgentBackupjobConf { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrAgentBackupjobConf { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Agent Backup jobs configuration information from $System." + Write-PScriboMessage "Discovering Veeam VBR Agent Backup jobs configuration information from $System." } process { @@ -38,20 +38,20 @@ function Get-AbrVbrAgentBackupjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Job Mode' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) common information." + Write-PScriboMessage "Discovered $($ABkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $ABkjob.Name 'Id' = $ABkjob.Id 'Type' = $ABkjob.Type 'Mode' = Switch ($ABkjob.Mode) { - 'ManagedByBackupServer' {'Managed by Backup Server'} - 'ManagedByAgent' {'Managed by Agent'} - default {$ABkjob.Mode} + 'ManagedByBackupServer' { 'Managed by Backup Server' } + 'ManagedByAgent' { 'Managed by Agent' } + default { $ABkjob.Mode } } 'Description' = $ABkjob.Description 'Priority' = Switch ($ABkjob.IsHighPriority) { - 'True' {'High Priority'} - 'False' {'Normal Priority'} + 'True' { 'High Priority' } + 'False' { 'Normal Priority' } } } $OutObj = [pscustomobject]$inobj @@ -71,7 +71,7 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -80,9 +80,8 @@ function Get-AbrVbrAgentBackupjobConf { } } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Common Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Common Information Section: $($_.Exception.Message)" } } try { @@ -90,26 +89,25 @@ function Get-AbrVbrAgentBackupjobConf { $OutObj = @() foreach ($BackupObject in $ABkjob.BackupObject) { try { - Write-PscriboMessage "Discovered $($BackupObject.Name) protected computer information." + Write-PScriboMessage "Discovered $($BackupObject.Name) protected computer information." $inObj = [ordered] @{ 'Name' = $BackupObject.Name 'Type' = SWitch ($BackupObject.Type) { - $Null {'Computer'} - default {$BackupObject.Type} + $Null { 'Computer' } + default { $BackupObject.Type } } 'Enabled' = ConvertTo-TextYN $BackupObject.Enabled 'Container' = Switch ($BackupObject.Container) { - $Null {'Individual Computer'} - 'ActiveDirectory' {'Active Directory'} - 'ManuallyDeployed' {'Manually Deployed'} - 'IndividualComputers' {'Individual Computers'} - default {$BackupObject.Container} + $Null { 'Individual Computer' } + 'ActiveDirectory' { 'Active Directory' } + 'ManuallyDeployed' { 'Manually Deployed' } + 'IndividualComputers' { 'Individual Computers' } + default { $BackupObject.Container } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Protected Computers Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Protected Computers Section: $($_.Exception.Message)" } } @@ -123,58 +121,53 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Protected Computers Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Protected Computers Section: $($_.Exception.Message)" } try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Backup Mode' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) backup mode information." + Write-PScriboMessage "Discovered $($ABkjob.Name) backup mode information." $inObj = [ordered] @{ 'Backup Mode' = Switch ($ABkjob.BackupType) { - 'EntireComputer' {'Entire Computer'} - 'SelectedVolumes' {'Volume Level Backup'} - 'SelectedFiles' {'File Level Backup (slower)'} + 'EntireComputer' { 'Entire Computer' } + 'SelectedVolumes' { 'Volume Level Backup' } + 'SelectedFiles' { 'File Level Backup (slower)' } } } if ($ABkjob.BackupType -eq 'EntireComputer') { - $inObj.add('Include external USB drives',(ConvertTo-TextYN $ABkjob.UsbDrivesIncluded)) - } - elseif ($ABkjob.BackupType -eq 'SelectedVolumes') { + $inObj.add('Include external USB drives', (ConvertTo-TextYN $ABkjob.UsbDrivesIncluded)) + } elseif ($ABkjob.BackupType -eq 'SelectedVolumes') { if ($Null -ne $ABkjob.SelectedVolumes.Path) { - $inObj.add('Backup the following volumes only',($ABkjob.SelectedVolumes.Path -join ', ')) - } - elseif ($Null -ne $ABkjob.ExcludedVolumes.Path) { - $inObj.add('Backup all volumes except the following',($ABkjob.ExcludedVolumes.Path -join ', ')) + $inObj.add('Backup the following volumes only', ($ABkjob.SelectedVolumes.Path -join ', ')) + } elseif ($Null -ne $ABkjob.ExcludedVolumes.Path) { + $inObj.add('Backup all volumes except the following', ($ABkjob.ExcludedVolumes.Path -join ', ')) } - } - elseif ($ABkjob.BackupType -eq 'SelectedFiles') { - $inObj.add('Backup Operating System Files',(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.BackupOS)) - $inObj.add('Backup Personal Files',(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.BackupPersonalFiles)) + } elseif ($ABkjob.BackupType -eq 'SelectedFiles') { + $inObj.add('Backup Operating System Files', (ConvertTo-TextYN $ABkjob.SelectedFilesOptions.BackupOS)) + $inObj.add('Backup Personal Files', (ConvertTo-TextYN $ABkjob.SelectedFilesOptions.BackupPersonalFiles)) if ($ABkjob.SelectedFilesOptions.BackupPersonalFiles -eq $TRUE) { - $inObj.add('User Profile Folder to Backup',("Desktop: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Desktop),`r`nDocuments: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Documents),`r`nPictures: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Pictures),`r`nVideo: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Video),`r`nFavorites: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Favorites),`r`nDownloads: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Downloads),`r`nApplicationData: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.ApplicationData),`r`nOther Files and Folders: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Custom),`r`nExclude Roaming Profile: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.ExcludeRoamingUsers)")) + $inObj.add('User Profile Folder to Backup', ("Desktop: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Desktop),`r`nDocuments: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Documents),`r`nPictures: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Pictures),`r`nVideo: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Video),`r`nFavorites: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Favorites),`r`nDownloads: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Downloads),`r`nApplicationData: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.ApplicationData),`r`nOther Files and Folders: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.Custom),`r`nExclude Roaming Profile: $(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.ExcludeRoamingUsers)")) } - $inObj.add('Backup File System Files',(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.BackupSelectedFiles)) + $inObj.add('Backup File System Files', (ConvertTo-TextYN $ABkjob.SelectedFilesOptions.BackupSelectedFiles)) if ($Null -ne $ABkjob.SelectedFilesOptions.SelectedFiles) { - $inObj.add('Files System Path',($ABkjob.SelectedFilesOptions.SelectedFiles -join ', ')) + $inObj.add('Files System Path', ($ABkjob.SelectedFilesOptions.SelectedFiles -join ', ')) } if ('' -ne $ABkjob.SelectedFilesOptions.IncludeMask) { - $inObj.add('Filter Files (Include Mask)',($ABkjob.SelectedFilesOptions.IncludeMask)) + $inObj.add('Filter Files (Include Mask)', ($ABkjob.SelectedFilesOptions.IncludeMask)) } if ('' -ne $ABkjob.SelectedFilesOptions.ExcludeMask) { - $inObj.add('Filter Files (Exclude Mask)',($ABkjob.SelectedFilesOptions.ExcludeMask)) + $inObj.add('Filter Files (Exclude Mask)', ($ABkjob.SelectedFilesOptions.ExcludeMask)) } if ($ABkjob.SelectedFilesOptions.BackupPersonalFiles -eq $TRUE) { - $inObj.add('Exclude Microsoft Onedrive Folders',(ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.ExcludeOneDrive)) + $inObj.add('Exclude Microsoft Onedrive Folders', (ConvertTo-TextYN $ABkjob.SelectedFilesOptions.SelectedPersonalFolders.ExcludeOneDrive)) } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Backup Mode Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Backup Mode Section: $($_.Exception.Message)" } $TableParams = @{ @@ -187,27 +180,24 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Backup Mode Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Backup Mode Section: $($_.Exception.Message)" } try { if ($ABkjob.Mode -eq 'ManagedByAgent') { $StorageTXT = 'Destination' - } - elseif ($ABkjob.Mode -eq 'ManagedByBackupServer') { + } elseif ($ABkjob.Mode -eq 'ManagedByBackupServer') { $StorageTXT = 'Storage' } Section -Style NOTOCHeading5 -ExcludeFromTOC $StorageTXT { $OutObj = @() if ($ABkjob.Mode -eq 'ManagedByAgent') { try { - Write-PscriboMessage "Discovered $($ABkjob.Name) destination information." + Write-PScriboMessage "Discovered $($ABkjob.Name) destination information." if ($ABkjob.RetentionType -eq "RestoreDays") { $RetainString = 'Retain Days To Keep' $Retains = $ABkjob.RetentionPolicy - } - elseif ($ABkjob.RetentionType -eq "RestorePoints") { + } elseif ($ABkjob.RetentionType -eq "RestorePoints") { $RetainString = 'Retain Points' $Retains = $ABkjob.RetentionPolicy } @@ -216,51 +206,47 @@ function Get-AbrVbrAgentBackupjobConf { } if ($ABkjob.Mode -eq 'ManagedByAgent') { $DestinationType = SWitch ($ABkjob.DestinationOptions.DestinationType) { - 'BackupRepository' {'Veeam Backup Repository'} - 'LocalStorage' {'Local Storage'} - 'NetworkFolder' {'Shared Folder'} - default {$ABkjob.DestinationOptions.DestinationType} + 'BackupRepository' { 'Veeam Backup Repository' } + 'LocalStorage' { 'Local Storage' } + 'NetworkFolder' { 'Shared Folder' } + default { $ABkjob.DestinationOptions.DestinationType } } } if ([Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($ABkjob.id)) { $SecondaryJobRepo = 'Yes' - } - else {$SecondaryJobRepo = 'No'} + } else { $SecondaryJobRepo = 'No' } $inObj = [ordered] @{ 'Destination Type' = $DestinationType 'Retention Policy' = Switch ($ABkjob.RetentionType) { - 'RestorePoints' {'Restore Points'} - 'RestoreDays' {'Restore Days'} - default {$ABkjob.RetentionType} + 'RestorePoints' { 'Restore Points' } + 'RestoreDays' { 'Restore Days' } + default { $ABkjob.RetentionType } } $RetainString = $Retains 'Configure Secondary Destination for this Job' = $SecondaryJobRepo } if ($ABkjob.DestinationOptions.DestinationType -eq 'BackupRepository') { - $inObj.add('Backup Server',($ABkjob.DestinationOptions.BackupServerName)) - $inObj.add('Backup Repository',($ABkjob.DestinationOptions.BackupRepository.Name)) - } - elseif ($ABkjob.DestinationOptions.DestinationType -eq 'LocalStorage') { - $inObj.add('Local Path',($ABkjob.DestinationOptions.LocalPath)) - } - elseif ($ABkjob.DestinationOptions.DestinationType -eq 'NetworkFolder') { - $inObj.add('Shared Folder',($ABkjob.DestinationOptions.NetworkFolderPath)) - $inObj.add('Target Share Type',($ABkjob.DestinationOptions.TargetShareType)) - $inObj.add('Use Network Credentials',(ConvertTo-TextYN $ABkjob.DestinationOptions.UseNetworkCredentials)) + $inObj.add('Backup Server', ($ABkjob.DestinationOptions.BackupServerName)) + $inObj.add('Backup Repository', ($ABkjob.DestinationOptions.BackupRepository.Name)) + } elseif ($ABkjob.DestinationOptions.DestinationType -eq 'LocalStorage') { + $inObj.add('Local Path', ($ABkjob.DestinationOptions.LocalPath)) + } elseif ($ABkjob.DestinationOptions.DestinationType -eq 'NetworkFolder') { + $inObj.add('Shared Folder', ($ABkjob.DestinationOptions.NetworkFolderPath)) + $inObj.add('Target Share Type', ($ABkjob.DestinationOptions.TargetShareType)) + $inObj.add('Use Network Credentials', (ConvertTo-TextYN $ABkjob.DestinationOptions.UseNetworkCredentials)) if ($ABkjob.DestinationOptions.UseNetworkCredentials) { - $inObj.add('Credentials',($ABkjob.DestinationOptions.NetworkCredentials.Name)) + $inObj.add('Credentials', ($ABkjob.DestinationOptions.NetworkCredentials.Name)) } } if ($ABkjob.GFSRetentionEnabled) { - $inObj.add('Keep certain full backup longer for archival purposes (GFS)',(ConvertTo-TextYN $ABkjob.GFSRetentionEnabled)) + $inObj.add('Keep certain full backup longer for archival purposes (GFS)', (ConvertTo-TextYN $ABkjob.GFSRetentionEnabled)) $inObj.add('Keep Weekly full backup for', ("$($ABkjob.GFSOptions.WeeklyOptions.RetentionPeriod) weeks,`r`nIf multiple backup exist use the one from: $($ABkjob.GFSOptions.WeeklyOptions.SelectedDay)")) $inObj.add('Keep Monthly full backup for', ("$($ABkjob.GFSOptions.MonthlyOptions.RetentionPeriod) months,`r`nUse weekly full backup from the following week of the month: $($ABkjob.GFSOptions.MonthlyOptions.SelectedWeek)")) $inObj.add('Keep Yearly full backup for', ("$($ABkjob.GFSOptions.YearlyOptions.RetentionPeriod) years,`r`nUse monthly full backup from the following month: $($ABkjob.GFSOptions.YearlyOptions.SelectedMonth)")) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Destination Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Destination Section: $($_.Exception.Message)" } $TableParams = @{ @@ -278,7 +264,7 @@ function Get-AbrVbrAgentBackupjobConf { $OutObj = @() $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($ABkjob.id) foreach ($SecondaryTarget in $SecondaryTargets) { - Write-PscriboMessage "Discovered $($ABkjob.Name) job secondary destination $($SecondaryTarget.Name)." + Write-PScriboMessage "Discovered $($ABkjob.Name) job secondary destination $($SecondaryTarget.Name)." $inObj = [ordered] @{ 'Job Name' = $SecondaryTarget.Name 'Type' = $SecondaryTarget.TypeToString @@ -298,20 +284,18 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Secondary Target Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Secondary Target Section: $($_.Exception.Message)" } } } if ($ABkjob.Mode -eq 'ManagedByBackupServer') { try { - Write-PscriboMessage "Discovered $($ABkjob.Name) destination information." + Write-PScriboMessage "Discovered $($ABkjob.Name) destination information." if ($ABkjob.RetentionType -eq "RestoreDays") { $RetainString = 'Retain Days To Keep' $Retains = $ABkjob.RetentionPolicy - } - elseif ($ABkjob.RetentionType -eq "RestorePoints") { + } elseif ($ABkjob.RetentionType -eq "RestorePoints") { $RetainString = 'Restore Points' $Retains = $ABkjob.RetentionPolicy } @@ -320,52 +304,48 @@ function Get-AbrVbrAgentBackupjobConf { } if ($ABkjob.Mode -eq 'ManagedByAgent') { $DestinationType = SWitch ($ABkjob.DestinationOptions.DestinationType) { - 'BackupRepository' {'Veeam Backup Repository'} - 'LocalStorage' {'Local Storage'} - 'NetworkFolder' {'Shared Folder'} - default {$ABkjob.DestinationOptions.DestinationType} + 'BackupRepository' { 'Veeam Backup Repository' } + 'LocalStorage' { 'Local Storage' } + 'NetworkFolder' { 'Shared Folder' } + default { $ABkjob.DestinationOptions.DestinationType } } } if ([Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($ABkjob.id)) { $SecondaryJobRepo = 'Yes' - } - else {$SecondaryJobRepo = 'No'} + } else { $SecondaryJobRepo = 'No' } $inObj = [ordered] @{ 'Backup Repository' = $ABkjob.BackupRepository.Name 'Repository Type' = $ABkjob.BackupRepository.Type 'Retention Policy' = Switch ($ABkjob.RetentionType) { - 'RestorePoints' {'Restore Points'} - 'RestoreDays' {'Restore Days'} - default {$ABkjob.RetentionType} + 'RestorePoints' { 'Restore Points' } + 'RestoreDays' { 'Restore Days' } + default { $ABkjob.RetentionType } } $RetainString = $Retains 'Configure Secondary Destination for this Job' = $SecondaryJobRepo } if ($ABkjob.DestinationOptions.DestinationType -eq 'BackupRepository') { - $inObj.add('Backup Server',($ABkjob.DestinationOptions.BackupServerName)) - $inObj.add('Backup Repository',($ABkjob.DestinationOptions.BackupRepository.Name)) - } - elseif ($ABkjob.DestinationOptions.DestinationType -eq 'LocalStorage') { - $inObj.add('Local Path',($ABkjob.DestinationOptions.LocalPath)) - } - elseif ($ABkjob.DestinationOptions.DestinationType -eq 'NetworkFolder') { - $inObj.add('Shared Folder',($ABkjob.DestinationOptions.NetworkFolderPath)) - $inObj.add('Target Share Type',($ABkjob.DestinationOptions.TargetShareType)) - $inObj.add('Use Network Credentials',(ConvertTo-TextYN $ABkjob.DestinationOptions.UseNetworkCredentials)) + $inObj.add('Backup Server', ($ABkjob.DestinationOptions.BackupServerName)) + $inObj.add('Backup Repository', ($ABkjob.DestinationOptions.BackupRepository.Name)) + } elseif ($ABkjob.DestinationOptions.DestinationType -eq 'LocalStorage') { + $inObj.add('Local Path', ($ABkjob.DestinationOptions.LocalPath)) + } elseif ($ABkjob.DestinationOptions.DestinationType -eq 'NetworkFolder') { + $inObj.add('Shared Folder', ($ABkjob.DestinationOptions.NetworkFolderPath)) + $inObj.add('Target Share Type', ($ABkjob.DestinationOptions.TargetShareType)) + $inObj.add('Use Network Credentials', (ConvertTo-TextYN $ABkjob.DestinationOptions.UseNetworkCredentials)) if ($ABkjob.DestinationOptions.UseNetworkCredentials) { - $inObj.add('Credentials',($ABkjob.DestinationOptions.NetworkCredentials.Name)) + $inObj.add('Credentials', ($ABkjob.DestinationOptions.NetworkCredentials.Name)) } } if ($ABkjob.GFSRetentionEnabled) { - $inObj.add('Keep certain full backup longer for archival purposes (GFS)',(ConvertTo-TextYN $ABkjob.GFSRetentionEnabled)) + $inObj.add('Keep certain full backup longer for archival purposes (GFS)', (ConvertTo-TextYN $ABkjob.GFSRetentionEnabled)) $inObj.add('Keep Weekly full backup for', ("$($ABkjob.GFSOptions.WeeklyOptions.RetentionPeriod) weeks,`r`nIf multiple backup exist use the one from: $($ABkjob.GFSOptions.WeeklyOptions.SelectedDay)")) $inObj.add('Keep Monthly full backup for', ("$($ABkjob.GFSOptions.MonthlyOptions.RetentionPeriod) months,`r`nUse weekly full backup from the following week of the month: $($ABkjob.GFSOptions.MonthlyOptions.SelectedWeek)")) $inObj.add('Keep Yearly full backup for', ("$($ABkjob.GFSOptions.YearlyOptions.RetentionPeriod) years,`r`nUse monthly full backup from the following month: $($ABkjob.GFSOptions.YearlyOptions.SelectedMonth)")) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Destination Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Destination Section: $($_.Exception.Message)" } $TableParams = @{ @@ -383,7 +363,7 @@ function Get-AbrVbrAgentBackupjobConf { $OutObj = @() $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($ABkjob.id) foreach ($SecondaryTarget in $SecondaryTargets) { - Write-PscriboMessage "Discovered $($ABkjob.Name) job secondary destination $($SecondaryTarget.Name)." + Write-PScriboMessage "Discovered $($ABkjob.Name) job secondary destination $($SecondaryTarget.Name)." $inObj = [ordered] @{ 'Job Name' = $SecondaryTarget.Name 'Type' = $SecondaryTarget.TypeToString @@ -403,9 +383,8 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Secondary Target Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Secondary Target Section: $($_.Exception.Message)" } } } @@ -414,7 +393,7 @@ function Get-AbrVbrAgentBackupjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Backup)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) backup options." + Write-PScriboMessage "Discovered $($ABkjob.Name) backup options." $inObj = [ordered] @{ 'Syntethic Full Backup' = ConvertTo-TextYN $ABkjob.SyntheticFullOptions.Enabled @@ -445,20 +424,18 @@ function Get-AbrVbrAgentBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Backup) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Backup) Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Backup) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Backup) Section: $($_.Exception.Message)" } try { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($ABkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $ABkjob.HealthCheckOptions.Enabled @@ -467,7 +444,7 @@ function Get-AbrVbrAgentBackupjobConf { $inObj.add('SLCG Schedule Type', $ABkjob.HealthCheckOptions.ScheduleType) $inObj.add('SLCG Schedule Day', $ABkjob.HealthCheckOptions.SelectedDays) } - if ($ABkjob.HealthCheckOptions.ScheduleType -ne 'Weekly'-and $ABkjob.HealthCheckOptions.Enabled) { + if ($ABkjob.HealthCheckOptions.ScheduleType -ne 'Weekly' -and $ABkjob.HealthCheckOptions.Enabled) { $inObj.add('SLCG Backup Monthly Schedule', "Day Of Week: $($ABkjob.HealthCheckOptions.DayOfWeek)`r`nDay Number In Month: $($ABkjob.HealthCheckOptions.DayNumber)`r`nDay of Month: $($ABkjob.HealthCheckOptions.DayOfMonth)`r`nMonths: $($ABkjob.HealthCheckOptions.SelectedMonths)") } @@ -506,32 +483,30 @@ function Get-AbrVbrAgentBackupjobConf { } } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Maintenance) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Maintenance) Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Maintenance) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Maintenance) Section: $($_.Exception.Message)" } try { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Storage)" { $OutObj = @() - Write-PscriboMessage "Discovered $($ABkjob.Name) storage options." + Write-PScriboMessage "Discovered $($ABkjob.Name) storage options." $inObj = [ordered] @{ 'Compression Level' = $ABkjob.StorageOptions.CompressionLevel 'Storage optimization' = $ABkjob.StorageOptions.StorageOptimizationType 'Enabled Backup File Encryption' = ConvertTo-TextYN $ABkjob.StorageOptions.EncryptionEnabled 'Encryption Key' = Switch ($ABkjob.StorageOptions.EncryptionEnabled) { - $false {'None'} - default {(Get-VBREncryptionKey | Where-Object { $_.id -eq $ABkjob.StorageOptions.EncryptionKey.Id }).Description} + $false { 'None' } + default { (Get-VBREncryptionKey | Where-Object { $_.id -eq $ABkjob.StorageOptions.EncryptionKey.Id }).Description } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Jobs.BestPractice) { - $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' + $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' } $TableParams = @{ @@ -544,9 +519,9 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' }) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Backup and replica data is a high potential source of vulnerability. To secure data stored in backups and replicas, use Veeam Backup & Replication inbuilt encryption to protect data in backups" @@ -554,14 +529,13 @@ function Get-AbrVbrAgentBackupjobConf { } } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Storage) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Storage) Section: $($_.Exception.Message)" } try { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() - Write-PscriboMessage "Discovered $($ABkjob.Name) notification options." + Write-PScriboMessage "Discovered $($ABkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $ABkjob.NotificationOptions.EnableSnmpNotification 'Send Email Notification' = ConvertTo-TextYN $ABkjob.NotificationOptions.EnableAdditionalNotification @@ -587,15 +561,14 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Notification) Section: $($_.Exception.Message)" } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Notification) Section: $($_.Exception.Message)" - } - if ($ABkjob.Mode -eq 'ManagedByBackupServer'-and $ABkjob.OSPlatform -eq 'Windows') { + if ($ABkjob.Mode -eq 'ManagedByBackupServer' -and $ABkjob.OSPlatform -eq 'Windows') { try { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Integration)" { $OutObj = @() - Write-PscriboMessage "Discovered $($ABkjob.Name) Integration options." + Write-PScriboMessage "Discovered $($ABkjob.Name) Integration options." $inObj = [ordered] @{ 'Enable Backup from Storage Snapshots' = ConvertTo-TextYN $ABkjob.SanIntegrationOptions.SanSnapshotsEnabled } @@ -618,9 +591,8 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Integration) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Integration) Section: $($_.Exception.Message)" } } if ($ABkjob.Mode -eq 'ManagedByBackupServer') { @@ -630,12 +602,11 @@ function Get-AbrVbrAgentBackupjobConf { if ($ABkjob.ScriptOptions.Periodicity -eq 'Days') { $FrequencyValue = $ABkjob.ScriptOptions.Day -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($ABkjob.ScriptOptions.Periodicity -eq 'Cycles') { + } elseif ($ABkjob.ScriptOptions.Periodicity -eq 'Cycles') { $FrequencyValue = $ABkjob.ScriptOptions.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($ABkjob.Name) script options." + Write-PScriboMessage "Discovered $($ABkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $ABkjob.ScriptOptions.PreScriptEnabled } @@ -664,9 +635,8 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Script) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Script) Section: $($_.Exception.Message)" } } } @@ -675,7 +645,7 @@ function Get-AbrVbrAgentBackupjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC "Guest Processing" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) guest processing." + Write-PScriboMessage "Discovered $($ABkjob.Name) guest processing." $inObj = [ordered] @{ 'Enabled Application Process Processing' = ConvertTo-TextYN $ABkjob.ApplicationProcessingEnabled 'Enabled Guest File System Indexing' = ConvertTo-TextYN $ABkjob.IndexingEnabled @@ -692,9 +662,8 @@ function Get-AbrVbrAgentBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Guest Processing) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Guest Processing) Section: $($_.Exception.Message)" } } } @@ -703,20 +672,17 @@ function Get-AbrVbrAgentBackupjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($ABkjob.Name) schedule options." if ($ABkjob.ScheduleOptions.Type -eq "Daily") { $ScheduleType = "Daily" $Schedule = "Recurrence: $($ABkjob.ScheduleOptions.DailyOptions.Type),`r`nDays: $($ABkjob.ScheduleOptions.DailyOptions.DayOfWeek)`r`nAt: $($ABkjob.ScheduleOptions.DailyOptions.Period)" - } - elseif ($ABkjob.ScheduleOptions.Type -eq "Monthly") { + } elseif ($ABkjob.ScheduleOptions.Type -eq "Monthly") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($ABkjob.ScheduleOptions.MonthlyOptions.DayOfMonth),`r`nDay Number In Month: $($ABkjob.ScheduleOptions.MonthlyOptions.DayNumberInMonth),`r`nDay Of Week: $($ABkjob.ScheduleOptions.MonthlyOptions.DayOfWeek)`r`nAt: $($ABkjob.ScheduleOptions.DailyOptions.Period)" - } - elseif ($ABkjob.ScheduleOptions.Type -eq "Periodically") { + } elseif ($ABkjob.ScheduleOptions.Type -eq "Periodically") { $ScheduleType = $ABkjob.ScheduleOptions.PeriodicallyOptions.PeriodicallyKind $Schedule = "Full Period: $($ABkjob.ScheduleOptions.PeriodicallyOptions.FullPeriod),`r`nHourly Offset: $($ABkjob.ScheduleOptions.PeriodicallyOptions.HourlyOffset)" - } - elseif ($ABkjob.ScheduleOptions.Type -eq "AfterJob") { + } elseif ($ABkjob.ScheduleOptions.Type -eq "AfterJob") { $ScheduleType = 'After Job' $Schedule = $ABkjob.ScheduleOptions.Job.Name } @@ -751,7 +717,7 @@ function Get-AbrVbrAgentBackupjobConf { $TableParams = @{ Name = "Backup Window - $($ABkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -759,31 +725,30 @@ function Get-AbrVbrAgentBackupjobConf { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style OFF -Property "Sat" - - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style ON -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style OFF -Property "Sat" + + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style ON -Property "Sat" $OutObj2 } } } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Schedule Options) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Schedule Options) Section: $($_.Exception.Message)" } } } @@ -791,13 +756,13 @@ function Get-AbrVbrAgentBackupjobConf { try { Section -Style NOTOCHeading5 -ExcludeFromTOC "Backup Cache" { $OutObj = @() - Write-PscriboMessage "Discovered $($ABkjob.Name) backup cache information." + Write-PScriboMessage "Discovered $($ABkjob.Name) backup cache information." $inObj = [ordered] @{ 'Maximun Size' = "$($ABkjob.BackupCacheOptions.SizeLimit) $($ABkjob.BackupCacheOptions.SizeUnit)" 'Type' = $ABkjob.BackupCacheOptions.Type 'Path' = Switch ($ABkjob.BackupCacheOptions.Type) { - 'Automatic' {'Auto Selected'} - default {$ABkjob.BackupCacheOptions.LocalPath} + 'Automatic' { 'Auto Selected' } + default { $ABkjob.BackupCacheOptions.LocalPath } } } $OutObj += [pscustomobject]$inobj @@ -812,16 +777,15 @@ function Get-AbrVbrAgentBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Backup Cache) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Backup Cache) Section: $($_.Exception.Message)" } } if ($ABkjob.Mode -eq 'ManagedByAgent') { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($ABkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($ABkjob.Name) schedule options." if ($ABkjob.ScheduleOptions.DailyScheduleEnabled) { $ScheduleType = 'Daily' $Schedule = "Recurrence: $($ABkjob.ScheduleOptions.DailyOptions.Type),`r`nDays: $($ABkjob.ScheduleOptions.DailyOptions.DayOfWeek)r`nAt: $($ABkjob.ScheduleOptions.DailyOptions.Period)" @@ -830,16 +794,13 @@ function Get-AbrVbrAgentBackupjobConf { if ($ABkjob.ScheduleOptions.Type -eq "Daily") { $ScheduleType = "Daily" $Schedule = "Recurrence: $($ABkjob.ScheduleOptions.DailyOptions.Type),`r`nDays: $($ABkjob.ScheduleOptions.DailyOptions.DayOfWeek)`r`nAt: $($ABkjob.ScheduleOptions.DailyOptions.Period)" - } - elseif ($ABkjob.ScheduleOptions.Type -eq "Monthly") { + } elseif ($ABkjob.ScheduleOptions.Type -eq "Monthly") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($ABkjob.ScheduleOptions.MonthlyOptions.DayOfMonth),`r`nDay Number In Month: $($ABkjob.ScheduleOptions.MonthlyOptions.DayNumberInMonth),`r`nDay Of Week: $($ABkjob.ScheduleOptions.MonthlyOptions.DayOfWeek)`r`nAt: $($ABkjob.ScheduleOptions.DailyOptions.Period)" - } - elseif ($ABkjob.ScheduleOptions.Type -eq "Periodically") { + } elseif ($ABkjob.ScheduleOptions.Type -eq "Periodically") { $ScheduleType = $ABkjob.ScheduleOptions.PeriodicallyOptions.PeriodicallyKind $Schedule = "Full Period: $($ABkjob.ScheduleOptions.PeriodicallyOptions.FullPeriod),`r`nHourly Offset: $($ABkjob.ScheduleOptions.PeriodicallyOptions.HourlyOffset)" - } - elseif ($ABkjob.ScheduleOptions.Type -eq "AfterJob") { + } elseif ($ABkjob.ScheduleOptions.Type -eq "AfterJob") { $ScheduleType = 'After Job' $Schedule = $ABkjob.ScheduleOptions.Job.Name } @@ -848,24 +809,24 @@ function Get-AbrVbrAgentBackupjobConf { 'Schedule type' = $ScheduleType 'Schedule Options' = $Schedule 'If Computer is Power Off Action' = SWitch ($ABkjob.ScheduleOptions.PowerOffAction) { - $null {'--'} - 'SkipBackup' {'Skip Backup'} - 'BackupAtPowerOn' {'Backup At Power On'} - default {$ABkjob.ScheduleOptions.PowerOffAction} + $null { '--' } + 'SkipBackup' { 'Skip Backup' } + 'BackupAtPowerOn' { 'Backup At Power On' } + default { $ABkjob.ScheduleOptions.PowerOffAction } } 'Once Backup is Taken' = Switch ($ABkjob.ScheduleOptions.PostBackupAction) { - $null {'--'} - 'KeepRunning' {'Keep Running'} - default {$ABkjob.ScheduleOptions.PostBackupAction} + $null { '--' } + 'KeepRunning' { 'Keep Running' } + default { $ABkjob.ScheduleOptions.PostBackupAction } } 'Backup At LogOff' = ConvertTo-TextYN $ABkjob.ScheduleOptions.BackupAtLogOff - 'Backup At Lock' = ConvertTo-TextYN $ABkjob.ScheduleOptions.BackupAtLock + 'Backup At Lock' = ConvertTo-TextYN $ABkjob.ScheduleOptions.BackupAtLock 'Backup At Target Connection' = ConvertTo-TextYN $ABkjob.ScheduleOptions.BackupAtTargetConnection 'Eject Storage After Backup' = ConvertTo-TextYN $ABkjob.ScheduleOptions.EjectStorageAfterBackup 'Backup Timeout' = Switch ([string]::IsNullOrEmpty($ABkjob.ScheduleOptions.BackupTimeout)) { - $true {'--'} - $false {"$($ABkjob.ScheduleOptions.BackupTimeout) $($ABkjob.ScheduleOptions.BackupTimeoutType)"} - default {"Unknown"} + $true { '--' } + $false { "$($ABkjob.ScheduleOptions.BackupTimeout) $($ABkjob.ScheduleOptions.BackupTimeoutType)" } + default { "Unknown" } } } $OutObj = [pscustomobject]$inobj @@ -879,28 +840,24 @@ function Get-AbrVbrAgentBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Schedule Options) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Settings (Schedule Options) Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Advanced Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Advanced Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Configuration Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Agent Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Agent Backup Jobs Configuration Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupCopyjob .ps1 b/Src/Private/Get-AbrVbrBackupCopyjob .ps1 index 9993d66..ec283d7 100644 --- a/Src/Private/Get-AbrVbrBackupCopyjob .ps1 +++ b/Src/Private/Get-AbrVbrBackupCopyjob .ps1 @@ -1,5 +1,5 @@ -function Get-AbrVbrBackupCopyjob { +function Get-AbrVbrBackupCopyjob { <# .SYNOPSIS Used by As Built Report to returns backup copy jobs created in Veeam Backup & Replication. @@ -21,7 +21,7 @@ function Get-AbrVbrBackupCopyjob { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Backup Copy jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR Backup Copy jobs information from $System." } process { @@ -34,21 +34,20 @@ function Get-AbrVbrBackupCopyjob { $OutObj = @() foreach ($BkCopyjob in $BkCopyjobs) { try { - Write-PscriboMessage "Discovered $($BkCopyjob.Name) backup copy." + Write-PScriboMessage "Discovered $($BkCopyjob.Name) backup copy." $inObj = [ordered] @{ 'Name' = $BkCopyjob.Name 'Copy Mode' = $BkCopyjob.Mode 'Status' = Switch ($BkCopyjob.JobEnabled) { - 'False' {'Disabled'} - 'True' {'Enabled'} + 'False' { 'Disabled' } + 'True' { 'Enabled' } } 'Latest Result' = $BkCopyjob.LastResult 'Scheduled?' = $BkCopyjob.ScheduleOptions.Type } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Backup Copy Jobs $($BkCopyjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Copy Jobs $($BkCopyjob.Name) Section: $($_.Exception.Message)" } } @@ -66,12 +65,11 @@ function Get-AbrVbrBackupCopyjob { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $OutObj | Sort-Object -Property 'Name' |Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Copy Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Copy Jobs Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupCopyjobConf.ps1 b/Src/Private/Get-AbrVbrBackupCopyjobConf.ps1 index 39aba10..117b5e6 100644 --- a/Src/Private/Get-AbrVbrBackupCopyjobConf.ps1 +++ b/Src/Private/Get-AbrVbrBackupCopyjobConf.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupCopyjobConf { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrBackupCopyjobConf { ) begin { - Write-PscriboMessage "Discovering Veeam VBR backup copy jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR backup copy jobs information from $System." } process { @@ -39,7 +39,7 @@ function Get-AbrVbrBackupCopyjobConf { $OutObj = @() try { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) common information." + Write-PScriboMessage "Discovered $($Bkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Id' = $Bkjob.Id @@ -50,12 +50,11 @@ function Get-AbrVbrBackupCopyjobConf { 'Next Run' = ConvertTo-EmptyToFiller $Bkjob.NextRun 'Include database transaction log backup' = ConvertTo-TextYN $Bkjob.TransactionLogCopyEnabled 'Description' = ConvertTo-EmptyToFiller $Bkjob.Description - 'Modified By' = (get-VBRJob -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Where-Object {$_.id -eq $Bkjob.Id}).Info.CommonInfo.ModifiedBy.FullName + 'Modified By' = (Get-VBRJob -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Where-Object { $_.id -eq $Bkjob.Id }).Info.CommonInfo.ModifiedBy.FullName } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } if ($HealthCheck.Jobs.BestPractice) { @@ -76,7 +75,7 @@ function Get-AbrVbrBackupCopyjobConf { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $_.'Description' -eq '--'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $_.'Description' -eq '--' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -85,9 +84,8 @@ function Get-AbrVbrBackupCopyjobConf { } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Bkjob.BackupJob) { @@ -96,7 +94,7 @@ function Get-AbrVbrBackupCopyjobConf { try { foreach ($LinkedBkJob in $Bkjob.BackupJob) { try { - Write-PscriboMessage "Discovered $($LinkedBkJob.Name) linked backup job objects." + Write-PScriboMessage "Discovered $($LinkedBkJob.Name) linked backup job objects." $inObj = [ordered] @{ 'Name' = $LinkedBkJob.Name 'Type' = $LinkedBkJob.TypeToString @@ -104,9 +102,8 @@ function Get-AbrVbrBackupCopyjobConf { 'Repository' = $LinkedBkJob.GetTargetRepository().Name } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -119,9 +116,8 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -131,7 +127,7 @@ function Get-AbrVbrBackupCopyjobConf { try { foreach ($LinkedRepository in $Bkjob.SourceRepository) { try { - Write-PscriboMessage "Discovered $($LinkedRepository.Name) linked repository objects." + Write-PScriboMessage "Discovered $($LinkedRepository.Name) linked repository objects." if ($LinkedRepository.Type -eq "ExtendableRepository") { $inObj = [ordered] @{ 'Name' = $LinkedRepository.Name @@ -146,9 +142,8 @@ function Get-AbrVbrBackupCopyjobConf { } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -161,30 +156,28 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } Section -Style NOTOCHeading5 -ExcludeFromTOC 'Target' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Target options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Target options." if ($Bkjob.RetentionType -eq "RestoreDays") { $RetainString = 'Retain Days To Keep' $Retains = $Bkjob.RetentionNumber - } - elseif ($Bkjob.RetentionType -eq "RestorePoints") { + } elseif ($Bkjob.RetentionType -eq "RestorePoints") { $RetainString = 'Restore Points' $Retains = $Bkjob.RetentionNumber } $inObj = [ordered] @{ 'Backup Repository' = $Bkjob.Target 'Retention Type' = SWitch ($Bkjob.RetentionType) { - 'RestoreDays' {'Restore Days'} - 'RestorePoints' {'Restore Points'} - default {'Unknown'} + 'RestoreDays' { 'Restore Days' } + 'RestorePoints' { 'Restore Points' } + default { 'Unknown' } } $RetainString = $Retains } @@ -221,7 +214,7 @@ function Get-AbrVbrBackupCopyjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($Bkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $Bkjob.HealthCheckOptions.Enabled 'SLCG Schedule Type' = $Bkjob.HealthCheckOptions.ScheduleType @@ -260,9 +253,8 @@ function Get-AbrVbrBackupCopyjobConf { } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -270,7 +262,7 @@ function Get-AbrVbrBackupCopyjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Storage)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." $inObj = [ordered] @{ 'Inline Data Deduplication' = ConvertTo-TextYN $Bkjob.StorageOptions.DataDeduplicationEnabled 'Compression Level' = $Bkjob.StorageOptions.CompressionLevel @@ -280,7 +272,7 @@ function Get-AbrVbrBackupCopyjobConf { $OutObj = [pscustomobject]$inobj if ($HealthCheck.Jobs.BestPractice) { - $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' + $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' } $TableParams = @{ @@ -293,18 +285,17 @@ function Get-AbrVbrBackupCopyjobConf { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' }) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Backup and replica data is a high potential source of vulnerability. To secure data stored in backups and replicas, use Veeam Backup & Replication inbuilt encryption to protect data in backups" } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -313,9 +304,9 @@ function Get-AbrVbrBackupCopyjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (RPO Monitor)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) rpo monitor options." - $BackupJob = $Bkjob.RpoWarningOptions | Where-Object {$_.RpoType -eq 'BackupJob'} - $BackupLogJob = $Bkjob.RpoWarningOptions | Where-Object {$_.RpoType -eq 'BackupLogJob'} + Write-PScriboMessage "Discovered $($Bkjob.Name) rpo monitor options." + $BackupJob = $Bkjob.RpoWarningOptions | Where-Object { $_.RpoType -eq 'BackupJob' } + $BackupLogJob = $Bkjob.RpoWarningOptions | Where-Object { $_.RpoType -eq 'BackupLogJob' } $inObj = [ordered] @{ 'Alert me when new backup is not copied within' = "$($BackupJob.Value) $($BackupJob.TimeUnit)`r`nEnable:$(ConvertTo-TextYN $BackupJob.EnableRpoWarning)" @@ -333,9 +324,8 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -344,13 +334,13 @@ function Get-AbrVbrBackupCopyjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) notification options." + Write-PScriboMessage "Discovered $($Bkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $Bkjob.NotificationOptions.EnableSnmpNotification 'Send Email Notification' = ConvertTo-TextYN $Bkjob.NotificationOptions.EnableAdditionalNotification 'Email Notification Additional Addresses' = Switch ($Bkjob.NotificationOptions.AdditionalAddress) { - $Null {'--'} - default {$Bkjob.NotificationOptions.AdditionalAddress} + $Null { '--' } + default { $Bkjob.NotificationOptions.AdditionalAddress } } 'Email Notify Time' = $Bkjob.NotificationOptions.SendTime 'Use Custom Email Notification Options' = ConvertTo-TextYN $Bkjob.NotificationOptions.UseNotificationOptions @@ -359,9 +349,9 @@ function Get-AbrVbrBackupCopyjobConf { 'Notify On Warning' = ConvertTo-TextYN $Bkjob.NotificationOptions.NotifyOnWarning 'Notify On Error' = ConvertTo-TextYN $Bkjob.NotificationOptions.NotifyOnError 'Send notification' = Switch ($Bkjob.NotificationOptions.EnableDailyNotification) { - 'False' {'Immediately after each copied backup'} - 'True' {'Daily as a summary'} - default {'Unknown'} + 'False' { 'Immediately after each copied backup' } + 'True' { 'Daily as a summary' } + default { 'Unknown' } } } $OutObj = [pscustomobject]$inobj @@ -375,9 +365,8 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -389,12 +378,11 @@ function Get-AbrVbrBackupCopyjobConf { if ($Bkjob.ScriptOptions.Periodicity -eq 'Days') { $FrequencyValue = $Bkjob.ScriptOptions.Days -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($Bkjob.ScriptOptions.Periodicity -eq 'Cycles') { + } elseif ($Bkjob.ScriptOptions.Periodicity -eq 'Cycles') { $FrequencyValue = $Bkjob.ScriptOptions.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($Bkjob.Name) script options." + Write-PScriboMessage "Discovered $($Bkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $Bkjob.ScriptOptions.PreScriptEnabled 'Run Script Before the Job' = ConvertTo-EmptyToFiller $Bkjob.ScriptOptions.PreCommand @@ -415,35 +403,32 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $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 } } Section -Style NOTOCHeading5 -ExcludeFromTOC 'Data Transfer' { $OutObj = @() try { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) data transfer." + Write-PScriboMessage "Discovered $($Bkjob.Name) data transfer." $inObj = [ordered] @{ 'Use Wan accelerator' = Switch ($Bkjob.DataTransferMode) { - 'ThroughWanAccelerators' {'Yes'} - 'Direct' {'No'} - default {'Unkwnown'} + 'ThroughWanAccelerators' { 'Yes' } + 'Direct' { 'No' } + default { 'Unkwnown' } } 'Source Wan accelerator' = ConvertTo-EmptyToFiller $Bkjob.SourceAccelerator.Name 'Target Wan accelerator' = ConvertTo-EmptyToFiller $Bkjob.TargetAccelerator.Name } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } $TableParams = @{ @@ -455,29 +440,25 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Bkjob.Mode -eq 'Periodic') { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." if ($Bkjob.ScheduleOptions.Type -eq "Daily") { $ScheduleType = "Daily" $Schedule = "Kind: $($Bkjob.ScheduleOptions.DailyOptions.Type) at $($Bkjob.ScheduleOptions.DailyOptions.Period.ToString()), Days of Week: $($Bkjob.ScheduleOptions.DailyOptions.DayOfWeek)" - } - elseif ($Bkjob.ScheduleOptions.Type -eq "Monthly") { + } elseif ($Bkjob.ScheduleOptions.Type -eq "Monthly") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($Bkjob.ScheduleOptions.MonthlyOptions.DayOfMonth),`r`nDay Number In Month: $($Bkjob.ScheduleOptions.MonthlyOptions.DayNumberInMonth),`r`nDay Of Week: $($Bkjob.ScheduleOptions.MonthlyOptions.DayOfWeek),`r`nAt $($Bkjob.ScheduleOptions.MonthlyOptions.Period.ToString())," - } - elseif ($Bkjob.ScheduleOptions.Type -eq "Periodically") { + } elseif ($Bkjob.ScheduleOptions.Type -eq "Periodically") { $ScheduleType = $Bkjob.ScheduleOptions.PeriodicallyOptions.PeriodicallyKind $Schedule = "Full Period: $($Bkjob.ScheduleOptions.PeriodicallyOptions.FullPeriod),`r`nHourly Offset: $($Bkjob.ScheduleOptions.PeriodicallyOptions.HourlyOffset),`r`nUnit: $($Bkjob.ScheduleOptions.PeriodicallyOptions.Unit)" - } - elseif ($Bkjob.ScheduleOptions.Type -eq "AfterJob") { + } elseif ($Bkjob.ScheduleOptions.Type -eq "AfterJob") { $ScheduleType = 'AfterJob' $Schedule = "After Job: $($BKjob.ScheduleOptions.Job.Name)" } @@ -513,7 +494,7 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams = @{ Name = "Backup Window - $($Bkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -521,31 +502,30 @@ function Get-AbrVbrBackupCopyjobConf { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style OFF -Property "Sat" - - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style ON -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style OFF -Property "Sat" + + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style ON -Property "Sat" $OutObj2 } } } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -553,7 +533,7 @@ function Get-AbrVbrBackupCopyjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." $inObj = [ordered] @{ 'Retry Failed Enabled?' = ConvertTo-TextYN $Bkjob.ScheduleOptions.RetryEnabled 'Retry Failed item processing' = $Bkjob.ScheduleOptions.RetryCount @@ -573,23 +553,20 @@ function Get-AbrVbrBackupCopyjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $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 } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } end {} diff --git a/Src/Private/Get-AbrVbrBackupProxy.ps1 b/Src/Private/Get-AbrVbrBackupProxy.ps1 index 67c601d..2f96aca 100644 --- a/Src/Private/Get-AbrVbrBackupProxy.ps1 +++ b/Src/Private/Get-AbrVbrBackupProxy.ps1 @@ -21,7 +21,7 @@ function Get-AbrVbrBackupProxy { ) begin { - Write-PscriboMessage "Discovering Veeam V&R Backup Proxies information from $System." + Write-PScriboMessage "Discovering Veeam V&R Backup Proxies information from $System." } process { @@ -39,23 +39,23 @@ function Get-AbrVbrBackupProxy { Write-PScriboMessage "Backup Proxy InfoLevel set at $($InfoLevel.Infrastructure.Proxy)." Write-PScriboMessage "Collecting Summary Information." foreach ($BackupProxy in $BackupProxies) { - Write-PscriboMessage "Discovered $($BackupProxy.Name) Repository." + Write-PScriboMessage "Discovered $($BackupProxy.Name) Repository." $inObj = [ordered] @{ 'Name' = $BackupProxy.Name 'Type' = $BackupProxy.Type 'Max Tasks Count' = $BackupProxy.MaxTasksCount 'Disabled' = ConvertTo-TextYN $BackupProxy.IsDisabled 'Status' = Switch (($BackupProxy.Host).IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {($BackupProxy.Host).IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { ($BackupProxy.Host).IsUnavailable } } } $OutObj += [pscustomobject]$inobj } if ($HealthCheck.Infrastructure.Proxy) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -85,15 +85,15 @@ function Get-AbrVbrBackupProxy { 'OS Type' = $BackupProxy.Host.Type 'Services Credential' = ConvertTo-EmptyToFiller $BackupProxy.Host.ProxyServicesCreds.Name 'Status' = Switch (($BackupProxy.Host).IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {($BackupProxy.Host).IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { ($BackupProxy.Host).IsUnavailable } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Proxy) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -108,9 +108,8 @@ function Get-AbrVbrBackupProxy { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # VMware Backup Proxy Inventory Summary Section # @@ -119,16 +118,16 @@ function Get-AbrVbrBackupProxy { Write-PScriboMessage "Hardware Inventory Status set as $($Options.EnableHardwareInventory)." if ($Options.EnableHardwareInventory) { Write-PScriboMessage "Collecting Hardware/Software Inventory Summary." - $BackupProxies = Get-VBRViProxy | Where-Object {$_.Host.Type -eq "Windows"} + $BackupProxies = Get-VBRViProxy | Where-Object { $_.Host.Type -eq "Windows" } if ($BackupProxies) { $vSphereVBProxyObj = foreach ($BackupProxy in $BackupProxies) { try { - Write-PscriboMessage "Collecting Backup Proxy Inventory Summary from $($BackupProxy.Host.Name)." + Write-PScriboMessage "Collecting Backup Proxy Inventory Summary from $($BackupProxy.Host.Name)." $CimSession = New-CimSession $BackupProxy.Host.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication $PssSession = New-PSSession $BackupProxy.Host.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication -ErrorAction SilentlyContinue if ($PssSession) { $HW = Invoke-Command -Session $PssSession -ScriptBlock { Get-ComputerInfo } - } else {Write-PscriboMessage -IsWarning "VMware Backup Proxies Hardware/Software Inventory: Unable to connect to $($BackupProxy.Host.Name)"} + } else { Write-PScriboMessage -IsWarning "VMware Backup Proxies Hardware/Software Inventory: Unable to connect to $($BackupProxy.Host.Name)" } if ($HW) { $License = Get-CimInstance -Query 'Select * from SoftwareLicensingProduct' -CimSession $CimSession | Where-Object { $_.LicenseStatus -eq 1 } $HWCPU = Get-CimInstance -Class Win32_Processor -CimSession $CimSession @@ -160,7 +159,7 @@ function Get-AbrVbrBackupProxy { $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Server) { - $OutObj | Where-Object { $_.'Number of CPU Cores' -lt 4} | Set-Style -Style Warning -Property 'Number of CPU Cores' + $OutObj | Where-Object { $_.'Number of CPU Cores' -lt 4 } | Set-Style -Style Warning -Property 'Number of CPU Cores' if ([int]([regex]::Matches($OutObj.'Physical Memory (GB)', "\d+(?!.*\d+)").value) -lt 8) { $OutObj | Set-Style -Style Warning -Property 'Physical Memory (GB)' } } @@ -192,9 +191,8 @@ function Get-AbrVbrBackupProxy { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $LocalDiskReport += $TempLocalDiskReport - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Local Disks $($Disk.Number) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Local Disks $($Disk.Number) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -208,9 +206,8 @@ function Get-AbrVbrBackupProxy { $LocalDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Fibre Channel Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Fibre Channel Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Proxy SAN Disk Inventory Section # @@ -230,9 +227,8 @@ function Get-AbrVbrBackupProxy { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $SanDiskReport += $TempSanDiskReport - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Fibre Channel $($Disk.Number) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Fibre Channel $($Disk.Number) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -246,13 +242,12 @@ function Get-AbrVbrBackupProxy { $SanDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Fibre Channel Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Fibre Channel Section: $($_.Exception.Message)" } } try { - $HostVolumes = Invoke-Command -Session $PssSession -ScriptBlock { Get-Volume | Where-Object {$_.DriveType -ne "CD-ROM" -and $NUll -ne $_.DriveLetter} } + $HostVolumes = Invoke-Command -Session $PssSession -ScriptBlock { Get-Volume | Where-Object { $_.DriveType -ne "CD-ROM" -and $NUll -ne $_.DriveLetter } } if ($HostVolumes) { Section -Style NOTOCHeading6 -ExcludeFromTOC 'Host Volumes' { $HostVolumeReport = @() @@ -267,9 +262,8 @@ function Get-AbrVbrBackupProxy { 'Health Status' = $HostVolume.HealthStatus } $HostVolumeReport += $TempHostVolumeReport - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Host Volumes $($HostVolume.DriveLetter) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Host Volumes $($HostVolume.DriveLetter) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -283,9 +277,8 @@ function Get-AbrVbrBackupProxy { $HostVolumeReport | Sort-Object -Property 'Drive Letter' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Host Volumes Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Host Volumes Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Proxy Network Inventory Section # @@ -305,9 +298,8 @@ function Get-AbrVbrBackupProxy { 'Link Speed' = $HostAdapter.LinkSpeed } $HostAdaptersReport += $TempHostAdaptersReport - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Network Adapter $($HostAdapter.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Network Adapter $($HostAdapter.Name) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -321,9 +313,8 @@ function Get-AbrVbrBackupProxy { $HostAdaptersReport | Sort-Object -Property 'Adapter Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Network Adapter Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Network Adapter Section: $($_.Exception.Message)" } try { $NetIPs = Invoke-Command -Session $PssSession { Get-NetIPConfiguration | Where-Object -FilterScript { ($_.NetAdapter.Status -Eq "Up") } } @@ -340,9 +331,8 @@ function Get-AbrVbrBackupProxy { 'IPv4 Gateway' = $NetIp.IPv4DefaultGateway.NextHop } $NetIpsReport += $TempNetIpsReport - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies IP Address $($NetIp.InterfaceAlias) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies IP Address $($NetIp.InterfaceAlias) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -356,18 +346,16 @@ function Get-AbrVbrBackupProxy { $NetIpsReport | Sort-Object -Property 'Interface Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies IP Address Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies IP Address Section: $($_.Exception.Message)" } } } Remove-PSSession -Session $PssSession Remove-CimSession $CimSession } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Section: $($_.Exception.Message)" } } if ($vSphereVBProxyObj) { @@ -377,9 +365,8 @@ function Get-AbrVbrBackupProxy { } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Hardware & Software Inventory Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Hardware & Software Inventory Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # VMware Backup Proxy Service information Section # @@ -389,14 +376,14 @@ function Get-AbrVbrBackupProxy { if ($InfoLevel.Infrastructure.Proxy -ge 1) { Write-PScriboMessage "Backup Proxy InfoLevel set at $($InfoLevel.Infrastructure.Proxy)." Write-PScriboMessage "Collecting Veeam Services Information." - $BackupProxies = Get-VBRViProxy | Where-Object {$_.Host.Type -eq "Windows"} + $BackupProxies = Get-VBRViProxy | Where-Object { $_.Host.Type -eq "Windows" } foreach ($BackupProxy in $BackupProxies) { try { $PssSession = New-PSSession $BackupProxy.Host.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication -ErrorAction SilentlyContinue if ($PssSession) { - $Available = Invoke-Command -Session $PssSession -ScriptBlock {Get-Service "W32Time" | Select-Object DisplayName, Name, Status} - Write-PscriboMessage "Collecting Backup Proxy Service information from $($BackupProxy.Name)." - $Services = Invoke-Command -Session $PssSession -ScriptBlock {Get-Service Veeam*} + $Available = Invoke-Command -Session $PssSession -ScriptBlock { Get-Service "W32Time" | Select-Object DisplayName, Name, Status } + Write-PScriboMessage "Collecting Backup Proxy Service information from $($BackupProxy.Name)." + $Services = Invoke-Command -Session $PssSession -ScriptBlock { Get-Service Veeam* } if ($PssSession) { Remove-PSSession -Session $PssSession } @@ -404,7 +391,7 @@ function Get-AbrVbrBackupProxy { Section -Style NOTOCHeading4 -ExcludeFromTOC "HealthCheck - $($BackupProxy.Host.Name.Split(".")[0]) Services Status" { $OutObj = @() foreach ($Service in $Services) { - Write-PscriboMessage "Collecting '$($Service.DisplayName)' status on $($BackupProxy.Name)." + Write-PScriboMessage "Collecting '$($Service.DisplayName)' status on $($BackupProxy.Name)." $inObj = [ordered] @{ 'Display Name' = $Service.DisplayName 'Short Name' = $Service.Name @@ -414,7 +401,7 @@ function Get-AbrVbrBackupProxy { } if ($HealthCheck.Infrastructure.Server) { - $OutObj | Where-Object { $_.'Status' -notlike 'Running'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -428,16 +415,14 @@ function Get-AbrVbrBackupProxy { $OutObj | Sort-Object -Property 'Display Name' | Table @TableParams } } - } else {Write-PscriboMessage -IsWarning "VMware Backup Proxies Services Status Section: Unable to connect to $($BackupProxy.Host.Name)"} - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies $($BackupProxy.Host.Name) Services Status Section: $($_.Exception.Message)" + } else { Write-PScriboMessage -IsWarning "VMware Backup Proxies Services Status Section: Unable to connect to $($BackupProxy.Host.Name)" } + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies $($BackupProxy.Host.Name) Services Status Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxies Services Status Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Proxies Services Status Section: $($_.Exception.Message)" } } if ($Options.EnableDiagrams) { @@ -445,7 +430,7 @@ function Get-AbrVbrBackupProxy { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-vSphere-Proxy" } Catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxy Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "VMware Backup Proxy Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "VMware Backup Proxy Diagram." { @@ -455,7 +440,7 @@ function Get-AbrVbrBackupProxy { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "VMware Backup Proxy Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "VMware Backup Proxy Diagram Section: $($_.Exception.Message)" } } } @@ -473,27 +458,26 @@ function Get-AbrVbrBackupProxy { Write-PScriboMessage "Collecting Summary Information." foreach ($BackupProxy in $BackupProxies) { try { - Write-PscriboMessage "Discovered $($BackupProxy.Name) Proxy." + Write-PScriboMessage "Discovered $($BackupProxy.Name) Proxy." $inObj = [ordered] @{ 'Name' = $BackupProxy.Name 'Type' = $BackupProxy.Type 'Max Tasks Count' = $BackupProxy.MaxTasksCount 'Disabled' = ConvertTo-TextYN $BackupProxy.IsDisabled 'Status' = Switch (($BackupProxy.Host).IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {($BackupProxy.Host).IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { ($BackupProxy.Host).IsUnavailable } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies $($BackupProxy.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies $($BackupProxy.Name) Section: $($_.Exception.Message)" } } if ($HealthCheck.Infrastructure.Proxy) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -512,7 +496,7 @@ function Get-AbrVbrBackupProxy { Write-PScriboMessage "Collecting Detailed Information." foreach ($BackupProxy in $BackupProxies) { try { - Write-PscriboMessage "Discovered $($BackupProxy.Name) Repository." + Write-PScriboMessage "Discovered $($BackupProxy.Name) Repository." $inObj = [ordered] @{ 'Name' = $BackupProxy.Name 'Host Name' = $BackupProxy.Host.Name @@ -523,15 +507,15 @@ function Get-AbrVbrBackupProxy { 'OS Type' = $BackupProxy.Host.Type 'Services Credential' = ConvertTo-EmptyToFiller $BackupProxy.Host.ProxyServicesCreds.Name 'Status' = Switch (($BackupProxy.Host).IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {($BackupProxy.Host).IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { ($BackupProxy.Host).IsUnavailable } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Proxy) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -543,9 +527,8 @@ function Get-AbrVbrBackupProxy { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies $($BackupProxy.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies $($BackupProxy.Name) Section: $($_.Exception.Message)" } } } @@ -561,12 +544,12 @@ function Get-AbrVbrBackupProxy { if ($BackupProxies) { $HyperVBProxyObj = foreach ($BackupProxy in $BackupProxies) { try { - Write-PscriboMessage "Collecting Backup Proxy Inventory Summary from $($BackupProxy.Host.Name)." + Write-PScriboMessage "Collecting Backup Proxy Inventory Summary from $($BackupProxy.Host.Name)." $CimSession = New-CimSession $BackupProxy.Host.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication $PssSession = New-PSSession $BackupProxy.Host.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication -ErrorAction SilentlyContinue if ($PssSession) { $HW = Invoke-Command -Session $PssSession -ScriptBlock { Get-ComputerInfo } - } else {Write-PscriboMessage -IsWarning "VMware Backup Proxies Inventory Section: Unable to connect to $($BackupProxy.Host.Name)"} + } else { Write-PScriboMessage -IsWarning "VMware Backup Proxies Inventory Section: Unable to connect to $($BackupProxy.Host.Name)" } if ($HW) { $License = Get-CimInstance -Query 'Select * from SoftwareLicensingProduct' -CimSession $CimSession | Where-Object { $_.LicenseStatus -eq 1 } $HWCPU = Get-CimInstance -Class Win32_Processor -CimSession $CimSession @@ -598,7 +581,7 @@ function Get-AbrVbrBackupProxy { $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Server) { - $OutObj | Where-Object { $_.'Number of CPU Cores' -lt 4} | Set-Style -Style Warning -Property 'Number of CPU Cores' + $OutObj | Where-Object { $_.'Number of CPU Cores' -lt 4 } | Set-Style -Style Warning -Property 'Number of CPU Cores' if ([int]([regex]::Matches($OutObj.'Physical Memory (GB)', "\d+(?!.*\d+)").value) -lt 8) { $OutObj | Set-Style -Style Warning -Property 'Physical Memory (GB)' } } @@ -630,9 +613,8 @@ function Get-AbrVbrBackupProxy { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $LocalDiskReport += $TempLocalDiskReport - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Local Disk $($Disk.Number) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Local Disk $($Disk.Number) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -646,9 +628,8 @@ function Get-AbrVbrBackupProxy { $LocalDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Local Disk Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Local Disk Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Proxy SAN Disk Inventory Section # @@ -668,9 +649,8 @@ function Get-AbrVbrBackupProxy { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $SanDiskReport += $TempSanDiskReport - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies SAN Disk $($Disk.Number) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies SAN Disk $($Disk.Number) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -684,16 +664,15 @@ function Get-AbrVbrBackupProxy { $SanDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Local Disk Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Local Disk Section: $($_.Exception.Message)" } } #---------------------------------------------------------------------------------------------# # Backup Proxy Volume Inventory Section # #---------------------------------------------------------------------------------------------# try { - $HostVolumes = Invoke-Command -Session $PssSession -ScriptBlock { Get-Volume | Where-Object {$_.DriveType -ne "CD-ROM" -and $NUll -ne $_.DriveLetter} } + $HostVolumes = Invoke-Command -Session $PssSession -ScriptBlock { Get-Volume | Where-Object { $_.DriveType -ne "CD-ROM" -and $NUll -ne $_.DriveLetter } } if ($HostVolumes) { Section -Style NOTOCHeading6 -ExcludeFromTOC 'Host Volumes' { $HostVolumeReport = @() @@ -708,9 +687,8 @@ function Get-AbrVbrBackupProxy { 'Health Status' = $HostVolume.HealthStatus } $HostVolumeReport += $TempHostVolumeReport - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Host Volume $($HostVolume.DriveLetter) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Host Volume $($HostVolume.DriveLetter) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -724,9 +702,8 @@ function Get-AbrVbrBackupProxy { $HostVolumeReport | Sort-Object -Property 'Drive Letter' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Host Volume Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Host Volume Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Proxy Network Inventory Section # @@ -746,9 +723,8 @@ function Get-AbrVbrBackupProxy { 'Link Speed' = $HostAdapter.LinkSpeed } $HostAdaptersReport += $TempHostAdaptersReport - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Network Adapter $($HostAdapter.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Network Adapter $($HostAdapter.Name) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -762,9 +738,8 @@ function Get-AbrVbrBackupProxy { $HostAdaptersReport | Sort-Object -Property 'Adapter Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Network Adapter Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Network Adapter Section: $($_.Exception.Message)" } try { $NetIPs = Invoke-Command -Session $PssSession { Get-NetIPConfiguration | Where-Object -FilterScript { ($_.NetAdapter.Status -Eq "Up") } } @@ -781,9 +756,8 @@ function Get-AbrVbrBackupProxy { 'IPv4 Gateway' = $NetIp.IPv4DefaultGateway.NextHop } $NetIpsReport += $TempNetIpsReport - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies IP Address $($NetIp.InterfaceAlias) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies IP Address $($NetIp.InterfaceAlias) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -797,18 +771,16 @@ function Get-AbrVbrBackupProxy { $NetIpsReport | Sort-Object -Property 'Interface Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies IP Address Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies IP Address Section: $($_.Exception.Message)" } } } Remove-PSSession -Session $PssSession Remove-CimSession $CimSession } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Hardware & Software Inventory Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Hardware & Software Inventory Section: $($_.Exception.Message)" } } if ($HyperVBProxyObj) { @@ -819,9 +791,8 @@ function Get-AbrVbrBackupProxy { } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Hyper-V Backup Proxy Service information Section # @@ -836,9 +807,9 @@ function Get-AbrVbrBackupProxy { try { $PssSession = New-PSSession $BackupProxy.Host.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication -ErrorAction SilentlyContinue if ($PssSession) { - $Available = Invoke-Command -Session $PssSession -ScriptBlock {Get-Service "W32Time" | Select-Object DisplayName, Name, Status} - Write-PscriboMessage "Collecting Backup Proxy Service information from $($BackupProxy.Name)." - $Services = Invoke-Command -Session $PssSession -ScriptBlock {Get-Service Veeam*} + $Available = Invoke-Command -Session $PssSession -ScriptBlock { Get-Service "W32Time" | Select-Object DisplayName, Name, Status } + Write-PScriboMessage "Collecting Backup Proxy Service information from $($BackupProxy.Name)." + $Services = Invoke-Command -Session $PssSession -ScriptBlock { Get-Service Veeam* } if ($PssSession) { Remove-PSSession -Session $PssSession } @@ -846,7 +817,7 @@ function Get-AbrVbrBackupProxy { Section -Style NOTOCHeading4 -ExcludeFromTOC "HealthCheck - $($BackupProxy.Host.Name.Split(".")[0]) Services Status" { $OutObj = @() foreach ($Service in $Services) { - Write-PscriboMessage "Collecting '$($Service.DisplayName)' status on $($BackupProxy.Name)." + Write-PScriboMessage "Collecting '$($Service.DisplayName)' status on $($BackupProxy.Name)." $inObj = [ordered] @{ 'Display Name' = $Service.DisplayName 'Short Name' = $Service.Name @@ -856,7 +827,7 @@ function Get-AbrVbrBackupProxy { } if ($HealthCheck.Infrastructure.Server) { - $OutObj | Where-Object { $_.'Status' -notlike 'Running'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -870,16 +841,14 @@ function Get-AbrVbrBackupProxy { $OutObj | Sort-Object -Property 'Display Name' | Table @TableParams } } - } else {Write-PscriboMessage -IsWarning "VMware Backup Proxies Services Status Section: Unable to connect to $($BackupProxy.Host.Name)"} - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Services Status - $($BackupProxy.Host.Name.Split(".")[0]) Section: $($_.Exception.Message)" + } else { Write-PScriboMessage -IsWarning "VMware Backup Proxies Services Status Section: Unable to connect to $($BackupProxy.Host.Name)" } + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Services Status - $($BackupProxy.Host.Name.Split(".")[0]) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Services Status Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Services Status Section: $($_.Exception.Message)" } } if ($Options.EnableDiagrams) { @@ -887,7 +856,7 @@ function Get-AbrVbrBackupProxy { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-HyperV-Proxy" } Catch { - Write-PscriboMessage -IsWarning "HyperV Backup Proxy Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "HyperV Backup Proxy Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "HyperV Backup Proxy Diagram." { @@ -897,20 +866,18 @@ function Get-AbrVbrBackupProxy { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "HyperV Backup Proxy Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "HyperV Backup Proxy Diagram Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Proxies Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Proxies Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Proxies Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Proxies Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupRepository.ps1 b/Src/Private/Get-AbrVbrBackupRepository.ps1 index 18b04fe..92c63ca 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.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrBackupRepository { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Backup Repository information from $System." + Write-PScriboMessage "Discovering Veeam VBR Backup Repository information from $System." } process { try { - [Array]$BackupRepos = Get-VBRBackupRepository | Where-Object {$_.Type -ne "SanSnapshotOnly"} | Sort-Object -Property Name + [Array]$BackupRepos = Get-VBRBackupRepository | Where-Object { $_.Type -ne "SanSnapshotOnly" } | Sort-Object -Property Name [Array]$ScaleOuts = Get-VBRBackupRepository -ScaleOut | Sort-Object -Property Name if ($ScaleOuts) { $Extents = Get-VBRRepositoryExtent -Repository $ScaleOuts | Sort-Object -Property Name @@ -36,12 +36,12 @@ function Get-AbrVbrBackupRepository { $OutObj = @() try { foreach ($BackupRepo in $BackupRepos) { - Write-PscriboMessage "Discovered $($BackupRepo.Name) Repository." + 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 (@($($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)) + $PercentFree = $([Math]::Round($UsedSpace / $($BackupRepo.GetContainer().CachedTotalSpace.InGigabytes) * 100)) } } $inObj = [ordered] @{ @@ -50,22 +50,21 @@ function Get-AbrVbrBackupRepository { 'Free Space' = "$($BackupRepo.GetContainer().CachedFreeSpace.InGigabytes) Gb" 'Used Space %' = $PercentFree 'Status' = Switch ($BackupRepo.IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {$BackupRepo.IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { $BackupRepo.IsUnavailable } } } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "Backup Repository Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Repository Section: $($_.Exception.Message)" } if ($HealthCheck.Infrastructure.BR) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' - $OutObj | Where-Object { $_.'Used Space %' -ge 75} | Set-Style -Style Warning -Property 'Used Space %' - $OutObj | Where-Object { $_.'Used Space %' -ge 90} | Set-Style -Style Critical -Property 'Used Space %' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Used Space %' -ge 75 } | Set-Style -Style Warning -Property 'Used Space %' + $OutObj | Where-Object { $_.'Used Space %' -ge 90 } | Set-Style -Style Critical -Property 'Used Space %' } $TableParams = @{ @@ -78,11 +77,11 @@ function Get-AbrVbrBackupRepository { } if ($Options.EnableCharts) { try { - $sampleData = $OutObj | Select-Object -Property 'Name','Used Space %' + $sampleData = $OutObj | Select-Object -Property 'Name', 'Used Space %' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'BackupRepository' -XField 'Name' -YField 'Used Space %' -ChartLegendName 'Backup Repository' -ChartTitleName 'UsedSpace' -ChartTitleText 'Percentage of Used Space' } catch { - Write-PscriboMessage -IsWarning "Backup Repository chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Backup Repository chart section: $($_.Exception.Message)" } } @@ -107,31 +106,31 @@ function Get-AbrVbrBackupRepository { try { Section -Style NOTOCHeading5 -ExcludeFromTOC $($BackupRepo.Name) { $OutObj = @() - Write-PscriboMessage "Discovered $($BackupRepo.Name) Backup Repository." + 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) + 'Extent of ScaleOut Backup Repository' = (($ScaleOuts | Where-Object { ($Extents | Where-Object { $_.name -eq $BackupRepo.Name }).ParentId -eq $_.Id }).Name) 'Backup Proxy' = Switch ([string]::IsNullOrEmpty(($BackupRepo.Host).Name)) { - $true {'--'} - $false {($BackupRepo.Host).Name} - default {'Unknown'} + $true { '--' } + $false { ($BackupRepo.Host).Name } + default { 'Unknown' } } 'Integration Type' = $BackupRepo.TypeDisplay 'Path' = Switch ([string]::IsNullOrEmpty($BackupRepo.FriendlyPath)) { - $true {'--'} - $false {$BackupRepo.FriendlyPath} - default {'Unknown'} + $true { '--' } + $false { $BackupRepo.FriendlyPath } + default { 'Unknown' } } 'Connection Type' = $BackupRepo.Type 'Max Task Count' = Switch ([string]::IsNullOrEmpty($BackupRepo.Options.MaxTaskCount)) { $true { Switch ([string]::IsNullOrEmpty($BackupRepo.Options.MaxTasksCount)) { - $true {'--'} - $false {$BackupRepo.Options.MaxTasksCount} - default {'Unknown'} + $true { '--' } + $false { $BackupRepo.Options.MaxTasksCount } + default { 'Unknown' } } } - $false {$BackupRepo.Options.MaxTaskCount} - default {'Unknown'} + $false { $BackupRepo.Options.MaxTaskCount } + default { 'Unknown' } } 'Use Nfs On Mount Host' = ConvertTo-TextYN $BackupRepo.UseNfsOnMountHost 'San Snapshot Only' = ConvertTo-TextYN $BackupRepo.IsSanSnapshotOnly @@ -147,12 +146,12 @@ function Get-AbrVbrBackupRepository { $inObj.Remove('Extent of ScaleOut Backup Repository') } - if ($BackupRepo.Type -in @('AmazonS3Compatible','WasabiS3')) { + if ($BackupRepo.Type -in @('AmazonS3Compatible', 'WasabiS3')) { $inObj.Add('Object Lock Enabled', (ConvertTo-TextYN $BackupRepo.ObjectLockEnabled)) } - if ($BackupRepo.Type -in @('AmazonS3Compatible','WasabiS3')) { - $inObj.Add('Mount Server', (Get-VBRServer | Where-Object {$_.id -eq $BackupRepo.MountHostId.Guid}).Name) + if ($BackupRepo.Type -in @('AmazonS3Compatible', 'WasabiS3')) { + $inObj.Add('Mount Server', (Get-VBRServer | Where-Object { $_.id -eq $BackupRepo.MountHostId.Guid }).Name) } $OutObj += [pscustomobject]$inobj @@ -181,23 +180,20 @@ function Get-AbrVbrBackupRepository { } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Repository Configuration $($BackupRepo.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Repository Configuration $($BackupRepo.Name) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Repository Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Repository Configuration Section: $($_.Exception.Message)" } } } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Repository Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Repository Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupServerCertificate.ps1 b/Src/Private/Get-AbrVbrBackupServerCertificate.ps1 index c2d86cb..c479518 100644 --- a/Src/Private/Get-AbrVbrBackupServerCertificate.ps1 +++ b/Src/Private/Get-AbrVbrBackupServerCertificate.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupServerCertificate { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrBackupServerCertificate { ) begin { - Write-PscriboMessage "Discovering Veeam VBR TLS certificates information from $System." + Write-PScriboMessage "Discovering Veeam VBR TLS certificates information from $System." } process { @@ -43,13 +43,12 @@ function Get-AbrVbrBackupServerCertificate { } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server TLS Certificate Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server TLS Certificate Section: $($_.Exception.Message)" } if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Enabled' -like 'No'} | Set-Style -Style Warning -Property 'Enabled' + $OutObj | Where-Object { $_.'Enabled' -like 'No' } | Set-Style -Style Warning -Property 'Enabled' } $TableParams = @{ @@ -63,9 +62,8 @@ function Get-AbrVbrBackupServerCertificate { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server TLS Certificate Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server TLS Certificate Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupServerInfo.ps1 b/Src/Private/Get-AbrVbrBackupServerInfo.ps1 index ed0084b..31a88e4 100644 --- a/Src/Private/Get-AbrVbrBackupServerInfo.ps1 +++ b/Src/Private/Get-AbrVbrBackupServerInfo.ps1 @@ -21,7 +21,7 @@ function Get-AbrVbrBackupServerInfo { ) begin { - Write-PscriboMessage "Discovering Veeam V&R Server information from $System." + Write-PScriboMessage "Discovering Veeam V&R Server information from $System." } process { @@ -35,60 +35,60 @@ function Get-AbrVbrBackupServerInfo { $CimSession = New-CimSession $BackupServer.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication $PssSession = New-PSSession $BackupServer.Name -Credential $Credential -Authentication $Options.PSDefaultAuthentication $SecurityOptions = Get-VBRSecurityOptions - try {$DomainJoined = Get-CimInstance -Class Win32_ComputerSystem -Property PartOfDomain -CimSession $CimSession} catch {'Unknown'} - Write-PscriboMessage "Collecting Backup Server information from $($BackupServer.Name)." + try { $DomainJoined = Get-CimInstance -Class Win32_ComputerSystem -Property PartOfDomain -CimSession $CimSession } catch { 'Unknown' } + Write-PScriboMessage "Collecting Backup Server information from $($BackupServer.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 {Write-PscriboMessage -IsWarning "Backup Server Inkoke-Command Section: $($_.Exception.Message)"} + $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 { Write-PScriboMessage -IsWarning "Backup Server Inkoke-Command Section: $($_.Exception.Message)" } try { $VeeamInfo = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication' } - } catch {Write-PscriboMessage -IsWarning "Backup Server Invoke-Command Section: $($_.Exception.Message)"} + } catch { Write-PScriboMessage -IsWarning "Backup Server Invoke-Command Section: $($_.Exception.Message)" } try { $VeeamDBFlavor = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations' } - } catch {Write-PscriboMessage -IsWarning "Backup Server Invoke-Command Section: $($_.Exception.Message)"} + } catch { Write-PScriboMessage -IsWarning "Backup Server Invoke-Command Section: $($_.Exception.Message)" } try { $VeeamDBInfo = Invoke-Command -Session $PssSession -ErrorAction SilentlyContinue -ScriptBlock { Get-ItemProperty -Path "HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\$(($Using:VeeamDBFlavor).SqlActiveConfiguration)" } - } catch {Write-PscriboMessage -IsWarning "Backup Server Invoke-Command Section: $($_.Exception.Message)"} - Write-PscriboMessage "Discovered $BackupServer Server." + } catch { Write-PScriboMessage -IsWarning "Backup Server Invoke-Command Section: $($_.Exception.Message)" } + Write-PScriboMessage "Discovered $BackupServer Server." $inObj = [ordered] @{ 'Server Name' = $BackupServer.Name 'Is Domain Joined?' = ConvertTo-TextYN $DomainJoined.PartOfDomain 'Version' = Switch (($VeeamVersion).count) { - 0 {"--"} - default {$VeeamVersion.DisplayVersion} + 0 { "--" } + default { $VeeamVersion.DisplayVersion } } 'Database Server' = Switch ([string]::IsNullOrEmpty($VeeamDBInfo.SqlServerName)) { - $true {"--"} - $false {$VeeamDBInfo.SqlServerName} - default {'Unknown'} + $true { "--" } + $false { $VeeamDBInfo.SqlServerName } + default { 'Unknown' } } 'Database Instance' = Switch ([string]::IsNullOrEmpty($VeeamDBInfo.SqlInstanceName)) { - $true {"--"} - $false {$VeeamDBInfo.SqlInstanceName} - default {'Unknown'} + $true { "--" } + $false { $VeeamDBInfo.SqlInstanceName } + default { 'Unknown' } } 'Database Name' = Switch ([string]::IsNullOrEmpty($VeeamDBInfo.SqlDatabaseName)) { - $true {"--"} - $false {$VeeamDBInfo.SqlDatabaseName} - default {'Unknown'} + $true { "--" } + $false { $VeeamDBInfo.SqlDatabaseName } + default { 'Unknown' } } 'Connection Ports' = Switch (($VeeamInfo.BackupServerPort).count) { - 0 {"--"} - default {"Backup Server Port: $($VeeamInfo.BackupServerPort)`r`nSecure Connections Port: $($VeeamInfo.SecureConnectionsPort)`r`nCloud Server Port: $($VeeamInfo.CloudServerPort)`r`nCloud Service Port: $($VeeamInfo.CloudSvcPort)"} + 0 { "--" } + default { "Backup Server Port: $($VeeamInfo.BackupServerPort)`r`nSecure Connections Port: $($VeeamInfo.SecureConnectionsPort)`r`nCloud Server Port: $($VeeamInfo.CloudServerPort)`r`nCloud Service Port: $($VeeamInfo.CloudSvcPort)" } } 'Install Path' = Switch (($VeeamInfo.CorePath).count) { - 0 {"--"} - default {$VeeamInfo.CorePath} + 0 { "--" } + default { $VeeamInfo.CorePath } } 'Audit Logs Path' = $SecurityOptions.AuditLogsPath 'Compress Old Audit Logs' = ConvertTo-TextYN $SecurityOptions.CompressOldAuditLogs 'Fips Compliant Mode' = Switch ($SecurityOptions.FipsCompliantModeEnabled) { - 'True' {"Enabled"} - 'False' {"Disabled"} + 'True' { "Enabled" } + 'False' { "Disabled" } } 'Linux host authentication' = Switch ($SecurityOptions.HostPolicy.Type) { - 'All' {"Add all discovered host to the list automatically"} - 'KnownHosts' {"Add unknown host to the list manually"} + 'All' { "Add all discovered host to the list automatically" } + 'KnownHosts' { "Add unknown host to the list manually" } } 'Logging Level' = $VeeamInfo.LoggingLevel @@ -100,14 +100,13 @@ function Get-AbrVbrBackupServerInfo { $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Section: $($_.Exception.Message)" } if ($HealthCheck.Infrastructure.BackupServer) { - $OutObj | Where-Object { $_.'Logging Level' -gt 4} | Set-Style -Style Warning -Property 'Logging Level' - $OutObj | Where-Object { $_.'Is Domain Joined?' -eq 'Yes'} | Set-Style -Style Warning -Property 'Is Domain Joined?' + $OutObj | Where-Object { $_.'Logging Level' -gt 4 } | Set-Style -Style Warning -Property 'Logging Level' + $OutObj | Where-Object { $_.'Is Domain Joined?' -eq 'Yes' } | Set-Style -Style Warning -Property 'Is Domain Joined?' } $TableParams = @{ @@ -120,7 +119,7 @@ function Get-AbrVbrBackupServerInfo { } $OutObj | Table @TableParams if ($HealthCheck.Infrastructure.BestPractice) { - if ($OutObj | Where-Object { $_.'Is Domain Joined?' -eq 'Yes'}) { + if ($OutObj | Where-Object { $_.'Is Domain Joined?' -eq 'Yes' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -148,9 +147,9 @@ function Get-AbrVbrBackupServerInfo { Write-PScriboMessage "Hardware Inventory Status set as $($Options.EnableHardwareInventory)." if ($Options.EnableHardwareInventory) { $BackupServer = Get-VBRServer -Type Local - Write-PscriboMessage "Collecting Backup Server Inventory Summary from $($BackupServer.Name)." + Write-PScriboMessage "Collecting Backup Server Inventory Summary from $($BackupServer.Name)." $HW = Invoke-Command -Session $PssSession -ScriptBlock { Get-ComputerInfo } - $License = Get-CimInstance -Query 'Select * from SoftwareLicensingProduct' -CimSession $CimSession | Where-Object { $_.LicenseStatus -eq 1 } + $License = Get-CimInstance -Query 'Select * from SoftwareLicensingProduct' -CimSession $CimSession | Where-Object { $_.LicenseStatus -eq 1 } $HWCPU = Get-CimInstance -Class Win32_Processor -CimSession $CimSession $HWBIOS = Get-CimInstance -Class Win32_Bios -CimSession $CimSession if ($HW) { @@ -181,7 +180,7 @@ function Get-AbrVbrBackupServerInfo { $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Server) { - $OutObj | Where-Object { $_.'Number of CPU Cores' -lt 2} | Set-Style -Style Warning -Property 'Number of CPU Cores' + $OutObj | Where-Object { $_.'Number of CPU Cores' -lt 2 } | Set-Style -Style Warning -Property 'Number of CPU Cores' if ([int]([regex]::Matches($OutObj.'Physical Memory (GB)', "\d+(?!.*\d+)").value) -lt 8) { $OutObj | Set-Style -Style Warning -Property 'Physical Memory (GB)' } } @@ -195,9 +194,9 @@ function Get-AbrVbrBackupServerInfo { } $OutObj | Table @TableParams if ($HealthCheck.Infrastructure.BestPractice) { - if (([int]([regex]::Matches($OutObj.'Physical Memory (GB)', "\d+(?!.*\d+)").value) -lt 8) -or ($OutObj | Where-Object { $_.'Number of CPU Cores' -lt 2})) { + if (([int]([regex]::Matches($OutObj.'Physical Memory (GB)', "\d+(?!.*\d+)").value) -lt 8) -or ($OutObj | Where-Object { $_.'Number of CPU Cores' -lt 2 })) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Recommended Veeam Backup Server minimum configuration is two CPU cores and 8GB of RAM." @@ -223,9 +222,8 @@ function Get-AbrVbrBackupServerInfo { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $LocalDiskReport += $TempLocalDiskReport - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Local Disk $($Disk.Number) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Local Disk $($Disk.Number) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -239,9 +237,8 @@ function Get-AbrVbrBackupServerInfo { $LocalDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Local Disk Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Local Disk Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Server SAN Disk Inventory Section # @@ -261,9 +258,8 @@ function Get-AbrVbrBackupServerInfo { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $SanDiskReport += $TempSanDiskReport - } - catch { - Write-PscriboMessage -IsWarning "Backup Server SAN Disk $($Disk.Number) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server SAN Disk $($Disk.Number) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -277,16 +273,15 @@ function Get-AbrVbrBackupServerInfo { $SanDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server SAN Disk Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server SAN Disk Section: $($_.Exception.Message)" } } #---------------------------------------------------------------------------------------------# # Backup Server Volume Inventory Section # #---------------------------------------------------------------------------------------------# try { - $HostVolumes = Invoke-Command -Session $PssSession -ScriptBlock { Get-Volume | Where-Object {$_.DriveType -ne "CD-ROM" -and $NUll -ne $_.DriveLetter} } + $HostVolumes = Invoke-Command -Session $PssSession -ScriptBlock { Get-Volume | Where-Object { $_.DriveType -ne "CD-ROM" -and $NUll -ne $_.DriveLetter } } if ($HostVolumes) { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Host Volumes' { $HostVolumeReport = @() @@ -301,9 +296,8 @@ function Get-AbrVbrBackupServerInfo { 'Health Status' = $HostVolume.HealthStatus } $HostVolumeReport += $TempHostVolumeReport - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Host Volume $($HostVolume.DriveLetter) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Host Volume $($HostVolume.DriveLetter) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -317,9 +311,8 @@ function Get-AbrVbrBackupServerInfo { $HostVolumeReport | Sort-Object -Property 'Drive Letter' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Host Volume Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Host Volume Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Server Network Inventory Section # @@ -339,9 +332,8 @@ function Get-AbrVbrBackupServerInfo { 'Link Speed' = $HostAdapter.LinkSpeed } $HostAdaptersReport += $TempHostAdaptersReport - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Host Volume $($HostAdapter.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Host Volume $($HostAdapter.Name) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -355,9 +347,8 @@ function Get-AbrVbrBackupServerInfo { $HostAdaptersReport | Sort-Object -Property 'Adapter Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Host Volume Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Host Volume Section: $($_.Exception.Message)" } try { $NetIPs = Invoke-Command -Session $PssSession { Get-NetIPConfiguration | Where-Object -FilterScript { ($_.NetAdapter.Status -Eq "Up") } } @@ -374,9 +365,8 @@ function Get-AbrVbrBackupServerInfo { 'IPv4 Gateway' = $NetIp.IPv4DefaultGateway.NextHop } $NetIpsReport += $TempNetIpsReport - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Host Volume $($NetIp.InterfaceAlias) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Host Volume $($NetIp.InterfaceAlias) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -390,17 +380,15 @@ function Get-AbrVbrBackupServerInfo { $NetIpsReport | Sort-Object -Property 'Interface Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Host Volume Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Host Volume Section: $($_.Exception.Message)" } } } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Inventory Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Inventory Summary Section: $($_.Exception.Message)" } try { Write-PScriboMessage "Infrastructure Backup Server InfoLevel set at $($InfoLevel.Infrastructure.BackupServer)." @@ -411,7 +399,7 @@ function Get-AbrVbrBackupServerInfo { "AgentLogOptions" = "flush" "LoggingLevel" = "4" "VNXBlockNaviSECCliPath" = "C:\Program Files\Veeam\Backup and Replication\Backup\EMC Navisphere CLI\NaviSECCli.exe" - "VNXeUemcliPath"= "C:\Program Files\Veeam\Backup and Replication\Backup\EMC Unisphere CLI\3.0.1\uemcli.exe" + "VNXeUemcliPath" = "C:\Program Files\Veeam\Backup and Replication\Backup\EMC Unisphere CLI\3.0.1\uemcli.exe" "SqlLockInfo" = "" "CloudServerPort" = "10003" "SqlDatabaseName" = "VeeamBackup" @@ -439,7 +427,7 @@ function Get-AbrVbrBackupServerInfo { if ($VeeamInfo) { $OutObj = @() $Hashtable = $VeeamInfo | ForEach-Object { - foreach ($prop in $_.psobject.Properties.Where({ $_.Name -notlike 'PS*'})) { + foreach ($prop in $_.psobject.Properties.Where({ $_.Name -notlike 'PS*' })) { [pscustomobject] @{ Key = $prop.Name Value = $prop.Value @@ -451,9 +439,9 @@ function Get-AbrVbrBackupServerInfo { $inObj = [ordered] @{ 'Registry Key' = $Registry.Key 'Registry Value' = Switch (($Registry.Value).count) { - 0 {'--'} - 1 {$Registry.Value} - default {$Registry.Value -Join ', '} + 0 { '--' } + 1 { $Registry.Value } + default { $Registry.Value -Join ', ' } } } @@ -476,9 +464,8 @@ function Get-AbrVbrBackupServerInfo { } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Non-Default Registry Keys Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Non-Default Registry Keys Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Backup Server Services Information Section # @@ -488,14 +475,14 @@ function Get-AbrVbrBackupServerInfo { try { Write-PScriboMessage "Infrastructure Backup Server InfoLevel set at $($InfoLevel.Infrastructure.BackupServer)." if ($InfoLevel.Infrastructure.BackupServer -ge 2) { - $Available = Invoke-Command -Session $PssSession -ScriptBlock {Get-Service "W32Time" | Select-Object DisplayName, Name, Status} - Write-PscriboMessage "Collecting Backup Server Service Summary from $($BackupServer.Name)." - $Services = Invoke-Command -Session $PssSession -ScriptBlock {Get-Service Veeam*} + $Available = Invoke-Command -Session $PssSession -ScriptBlock { Get-Service "W32Time" | Select-Object DisplayName, Name, Status } + Write-PScriboMessage "Collecting Backup Server Service Summary from $($BackupServer.Name)." + $Services = Invoke-Command -Session $PssSession -ScriptBlock { Get-Service Veeam* } if ($Available) { Section -Style Heading4 "HealthCheck - Services Status" { $OutObj = @() foreach ($Service in $Services) { - Write-PscriboMessage "Collecting '$($Service.DisplayName)' status on $($BackupServer.Name)." + Write-PScriboMessage "Collecting '$($Service.DisplayName)' status on $($BackupServer.Name)." $inObj = [ordered] @{ 'Display Name' = $Service.DisplayName 'Short Name' = $Service.Name @@ -505,7 +492,7 @@ function Get-AbrVbrBackupServerInfo { } if ($HealthCheck.Infrastructure.Server) { - $OutObj | Where-Object { $_.'Status' -notlike 'Running'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -520,21 +507,19 @@ function Get-AbrVbrBackupServerInfo { } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Service Status Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Service Status Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Server Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Server Section: $($_.Exception.Message)" } } end { - if ($PssSession) {Remove-PSSession -Session $PssSession} - if ($CimSession) {Remove-CimSession $CimSession} + if ($PssSession) { Remove-PSSession -Session $PssSession } + if ($CimSession) { Remove-CimSession $CimSession } } } \ No newline at end of file diff --git a/Src/Private/Get-AbrVbrBackupToTape.ps1 b/Src/Private/Get-AbrVbrBackupToTape.ps1 index f491cf3..bfb42c5 100644 --- a/Src/Private/Get-AbrVbrBackupToTape.ps1 +++ b/Src/Private/Get-AbrVbrBackupToTape.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupToTape { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrBackupToTape { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Tape Backup jobs configuration information from $System." + Write-PScriboMessage "Discovering Veeam VBR Tape Backup jobs configuration information from $System." } process { try { - $TBkjobs = Get-VBRTapeJob | Where-Object {$_.Type -eq 'BackupToTape'} | Sort-Object -Property Name + $TBkjobs = Get-VBRTapeJob | Where-Object { $_.Type -eq 'BackupToTape' } | Sort-Object -Property Name if ($TBkjobs) { Section -Style Heading3 'Backup To Tape Job Configuration' { Paragraph "The following section details the configuration about the backup to tape jobs ." @@ -38,19 +38,19 @@ function Get-AbrVbrBackupToTape { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Backups Information' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) common information." + Write-PScriboMessage "Discovered $($TBkjob.Name) common information." if ($TBkjob.Object.Group -eq 'BackupRepository') { - $RepoSize = $TBkjob.Object | Where-Object {$_.Group -eq 'BackupRepository'} + $RepoSize = $TBkjob.Object | Where-Object { $_.Group -eq 'BackupRepository' } $TotalBackupSize = (($TBkjob.Object.info.IncludedSize | Measure-Object -Sum ).Sum) + ($RepoSize.GetContainer().CachedTotalSpace.InBytes - $RepoSize.GetContainer().CachedFreeSpace.InBytes) - } else {$TotalBackupSize = ($TBkjob.Object.info.IncludedSize | Measure-Object -Sum).Sum} + } else { $TotalBackupSize = ($TBkjob.Object.info.IncludedSize | Measure-Object -Sum).Sum } $inObj = [ordered] @{ 'Name' = $TBkjob.Name 'Type' = $TBkjob.Type 'Total Backup Size' = ConvertTo-FileSizeString $TotalBackupSize 'Next Run' = Switch ($TBkjob.Enabled) { - 'False' {'Disabled'} - default {$TBkjob.NextRun} + 'False' { 'Disabled' } + default { $TBkjob.NextRun } } 'Description' = $TBkjob.Description } @@ -71,7 +71,7 @@ function Get-AbrVbrBackupToTape { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -80,9 +80,8 @@ function Get-AbrVbrBackupToTape { } } } - } - catch { - Write-PscriboMessage -IsWarning "Common Information - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Common Information - $($TBkjob.Name) Section: $($_.Exception.Message)" } } if ($TBkjob.Object) { @@ -91,7 +90,7 @@ function Get-AbrVbrBackupToTape { $OutObj = @() foreach ($LinkedBkJob in $TBkjob.Object) { try { - Write-PscriboMessage "Discovered $($LinkedBkJob.Name) backup objects." + Write-PScriboMessage "Discovered $($LinkedBkJob.Name) backup objects." if ($LinkedBkJob.Type) { $Repository = $LinkedBkJob.Name $Type = 'Repository' @@ -101,7 +100,7 @@ function Get-AbrVbrBackupToTape { } if ($LinkedBkJob.Group -eq 'BackupRepository') { $TotalBackupSize = ConvertTo-FileSizeString ($LinkedBkJob.GetContainer().CachedTotalSpace.InBytes - $LinkedBkJob.GetContainer().CachedFreeSpace.InBytes) - } else {$TotalBackupSize = ConvertTo-FileSizeString $LinkedBkJob.Info.IncludedSize} + } else { $TotalBackupSize = ConvertTo-FileSizeString $LinkedBkJob.Info.IncludedSize } $inObj = [ordered] @{ 'Name' = $LinkedBkJob.Name @@ -110,9 +109,8 @@ function Get-AbrVbrBackupToTape { 'Repository' = $Repository } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Backups Objects - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backups Objects - $($TBkjob.Name) Section: $($_.Exception.Message)" } } @@ -126,9 +124,8 @@ function Get-AbrVbrBackupToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Backups Objects Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backups Objects Section: $($_.Exception.Message)" } } if ($TBkjob.FullBackupMediaPool) { @@ -137,58 +134,58 @@ function Get-AbrVbrBackupToTape { $OutObj = @() foreach ($BackupMediaPool in $TBkjob.FullBackupMediaPool) { try { - Write-PscriboMessage "Discovered $($TBkjob.Name) media pool." + Write-PScriboMessage "Discovered $($TBkjob.Name) media pool." #Todo Fix this mess! if ($BackupMediaPool.Type -eq "Gfs") { if ($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $MoveFromMediaPoolAutomatically = 'Use any available media' - } else {$MoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $MoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $AppendToCurrentTape = 'append' - } else {$AppendToCurrentTape = "do not append"} + } else { $AppendToCurrentTape = "do not append" } if ($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $MoveOfflineToVault = "export to vault $($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$MoveOfflineToVault = "do not export"} + } else { $MoveOfflineToVault = "do not export" } if ($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $WeeklyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$WeeklyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $WeeklyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $WeeklyAppendToCurrentTape = 'append' - } else {$WeeklyAppendToCurrentTape = "do not append"} + } else { $WeeklyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $WeeklyMoveOfflineToVault = "export to vault $($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$WeeklyMoveOfflineToVault = "do not export"} + } else { $WeeklyMoveOfflineToVault = "do not export" } if ($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $MonthlyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$MonthlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $MonthlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $MonthlyAppendToCurrentTape = 'append' - } else {$MonthlyAppendToCurrentTape = "do not append"} + } else { $MonthlyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $MonthlyMoveOfflineToVault = "export to vault $($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$MonthlyMoveOfflineToVault = "do not export"} + } else { $MonthlyMoveOfflineToVault = "do not export" } if ($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $QuarterlyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$QuarterlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $QuarterlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $QuarterlyAppendToCurrentTape = 'append' - } else {$QuarterlyAppendToCurrentTape = "do not append"} + } else { $QuarterlyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $QuarterlyMoveOfflineToVault = "export to vault $($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$QuarterlyMoveOfflineToVault = "do not export"} + } else { $QuarterlyMoveOfflineToVault = "do not export" } if ($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $YearlyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$YearlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $YearlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $YearlyAppendToCurrentTape = 'append' - } else {$YearlyAppendToCurrentTape = "do not append"} + } else { $YearlyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $YearlyMoveOfflineToVault = "export to vault $($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$YearlyMoveOfflineToVault = "do not export"} + } else { $YearlyMoveOfflineToVault = "do not export" } } $inObj = [ordered] @{ @@ -198,9 +195,9 @@ function Get-AbrVbrBackupToTape { 'Free Space' = ConvertTo-FileSizeString ((Get-VBRTapeMedium -MediaPool $BackupMediaPool.Name).Free | Measure-Object -Sum).Sum 'Encryption Enabled' = ConvertTo-TextYN $BackupMediaPool.EncryptionOptions.Enabled 'Encryption Key' = Switch ($BackupMediaPool.EncryptionOptions.Enabled) { - 'True' {(Get-VBREncryptionKey | Where-Object {$_.Id -eq $BackupMediaPool.EncryptionOptions.Key.Id}).Description} - 'False' {'Disabled'} - default {$BackupMediaPool.EncryptionOptions.Key.Id} + 'True' { (Get-VBREncryptionKey | Where-Object { $_.Id -eq $BackupMediaPool.EncryptionOptions.Key.Id }).Description } + 'False' { 'Disabled' } + default { $BackupMediaPool.EncryptionOptions.Key.Id } } 'Parallel Processing' = "$(ConvertTo-TextYN $BackupMediaPool.MultiStreamingOptions.NumberOfStreams) drives; Multiple Backup Chains: $(ConvertTo-TextYN $BackupMediaPool.MultiStreamingOptions.SplitJobFilesBetweenDrives)" 'Is WORM' = ConvertTo-TextYN $BackupMediaPool.Worm @@ -214,20 +211,20 @@ function Get-AbrVbrBackupToTape { } if ($BackupMediaPool.Type -eq "Custom") { $Vault = Switch (($TBkjob.FullBackupMediaPool.Vault).count) { - 0 {"Disabled"} - default {$TBkjob.FullBackupMediaPool.Vault} + 0 { "Disabled" } + default { $TBkjob.FullBackupMediaPool.Vault } } $Retention = Switch ($TBkjob.FullBackupMediaPool.RetentionPolicy.Type) { - $Null {"Disabled"} - 'Period' {"Protect data for $($TBkjob.FullBackupMediaPool.RetentionPolicy.Value) $($TBkjob.FullBackupMediaPool.RetentionPolicy.Period)"} - 'Cyclic' {'Do not protect data (cyclically overwrite tape as required)'} - 'Never' {'Never Overwrite Data'} + $Null { "Disabled" } + 'Period' { "Protect data for $($TBkjob.FullBackupMediaPool.RetentionPolicy.Value) $($TBkjob.FullBackupMediaPool.RetentionPolicy.Period)" } + 'Cyclic' { 'Do not protect data (cyclically overwrite tape as required)' } + 'Never' { 'Never Overwrite Data' } } $MediaSetPolicy = Switch ($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.Type) { - $Null {"Disabled"} - 'Always' {"Create new media set for every backup session"} - 'Daily' {"Daily at $($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Period), $($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Type)"} - 'Never' {'Do not create, always continue using current media set'} + $Null { "Disabled" } + 'Always' { "Create new media set for every backup session" } + 'Daily' { "Daily at $($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Period), $($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Type)" } + 'Never' { 'Do not create, always continue using current media set' } } $inObj.add('Retention', ($Retention)) $inObj.add('Export to Vault', (ConvertTo-TextYN $TBkjob.FullBackupMediaPool.MoveOfflineToVault)) @@ -237,24 +234,23 @@ function Get-AbrVbrBackupToTape { if ($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.Type -eq 'Daily') { $inObj.add('On these days', ($TBkjob.FullBackupMediaPool.MediaSetCreationPolicy.DailyOptions.DayOfWeek -join ", ")) } - if ($TBkjob.FullBackupPolicy.Type -eq 'WeeklyOnDays') { + if ($TBkjob.FullBackupPolicy.Type -eq 'WeeklyOnDays') { $DayOfWeek = Switch (($TBkjob.FullBackupPolicy.WeeklyOnDays).count) { - 7 {'Everyday'} - default {$TBkjob.FullBackupPolicy.WeeklyOnDays -join ", "} + 7 { 'Everyday' } + default { $TBkjob.FullBackupPolicy.WeeklyOnDays -join ", " } } $inObj.add('Full Backup Schedule', ("Weekly on selected days: $DayOfWeek")) } else { $Months = Switch (($TBkjob.FullBackupPolicy.MonthlyOptions.Months).count) { - 12 {'Every Month'} - default {$TBkjob.FullBackupPolicy.MonthlyOptions.Months -join ", "} + 12 { 'Every Month' } + default { $TBkjob.FullBackupPolicy.MonthlyOptions.Months -join ", " } } $inObj.add('Full Backup Schedule', ("Monthly on: $($TBkjob.FullBackupPolicy.MonthlyOptions.DayNumberInMonth), $($TBkjob.FullBackupPolicy.MonthlyOptions.DayOfWeek) of $Months")) } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Media Pool - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Media Pool - $($TBkjob.Name) Section: $($_.Exception.Message)" } } @@ -268,9 +264,8 @@ function Get-AbrVbrBackupToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Media Pool Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Media Pool Section: $($_.Exception.Message)" } } if ($TBkjob.ProcessIncrementalBackup -and $TBkjob.FullBackupMediaPool.Type -eq 'Custom') { @@ -279,58 +274,58 @@ function Get-AbrVbrBackupToTape { $OutObj = @() foreach ($BackupMediaPool in $TBkjob.IncrementalBackupMediaPool) { try { - Write-PscriboMessage "Discovered $($TBkjob.Name) incremental backup." + Write-PScriboMessage "Discovered $($TBkjob.Name) incremental backup." #Todo Fix this mess! if ($BackupMediaPool.Type -eq "Gfs") { if ($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $MoveFromMediaPoolAutomatically = 'Use any available media' - } else {$MoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $MoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $AppendToCurrentTape = 'append' - } else {$AppendToCurrentTape = "do not append"} + } else { $AppendToCurrentTape = "do not append" } if ($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $MoveOfflineToVault = "export to vault $($BackupMediaPool.DailyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$MoveOfflineToVault = "do not export"} + } else { $MoveOfflineToVault = "do not export" } if ($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $WeeklyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$WeeklyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $WeeklyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $WeeklyAppendToCurrentTape = 'append' - } else {$WeeklyAppendToCurrentTape = "do not append"} + } else { $WeeklyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $WeeklyMoveOfflineToVault = "export to vault $($BackupMediaPool.WeeklyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$WeeklyMoveOfflineToVault = "do not export"} + } else { $WeeklyMoveOfflineToVault = "do not export" } if ($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $MonthlyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$MonthlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $MonthlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $MonthlyAppendToCurrentTape = 'append' - } else {$MonthlyAppendToCurrentTape = "do not append"} + } else { $MonthlyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $MonthlyMoveOfflineToVault = "export to vault $($BackupMediaPool.MonthlyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$MonthlyMoveOfflineToVault = "do not export"} + } else { $MonthlyMoveOfflineToVault = "do not export" } if ($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $QuarterlyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$QuarterlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $QuarterlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $QuarterlyAppendToCurrentTape = 'append' - } else {$QuarterlyAppendToCurrentTape = "do not append"} + } else { $QuarterlyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $QuarterlyMoveOfflineToVault = "export to vault $($BackupMediaPool.QuarterlyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$QuarterlyMoveOfflineToVault = "do not export"} + } else { $QuarterlyMoveOfflineToVault = "do not export" } if ($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.MoveFromMediaPoolAutomatically) { $YearlyMoveFromMediaPoolAutomatically = 'Use any available media' - } else {$YearlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.Medium).count) selected"} + } else { $YearlyMoveFromMediaPoolAutomatically = "Use $(($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.Medium).count) selected" } if ($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.AppendToCurrentTape) { $YearlyAppendToCurrentTape = 'append' - } else {$YearlyAppendToCurrentTape = "do not append"} + } else { $YearlyAppendToCurrentTape = "do not append" } if ($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.MoveOfflineToVault) { $YearlyMoveOfflineToVault = "export to vault $($BackupMediaPool.YearlyMediaSetOptions.MediaSetPolicy.Vault.Name)" - } else {$YearlyMoveOfflineToVault = "do not export"} + } else { $YearlyMoveOfflineToVault = "do not export" } } $inObj = [ordered] @{ @@ -340,9 +335,9 @@ function Get-AbrVbrBackupToTape { 'Free Space' = ConvertTo-FileSizeString ((Get-VBRTapeMedium -MediaPool $BackupMediaPool.Name).Free | Measure-Object -Sum).Sum 'Encryption Enabled' = ConvertTo-TextYN $BackupMediaPool.EncryptionOptions.Enabled 'Encryption Key' = Switch ($BackupMediaPool.EncryptionOptions.Enabled) { - 'True' {(Get-VBREncryptionKey | Where-Object {$_.Id -eq $BackupMediaPool.EncryptionOptions.Key.Id}).Description} - 'False' {'Disabled'} - default {$BackupMediaPool.EncryptionOptions.Key.Id} + 'True' { (Get-VBREncryptionKey | Where-Object { $_.Id -eq $BackupMediaPool.EncryptionOptions.Key.Id }).Description } + 'False' { 'Disabled' } + default { $BackupMediaPool.EncryptionOptions.Key.Id } } 'Parallel Processing' = "$(ConvertTo-TextYN $BackupMediaPool.MultiStreamingOptions.NumberOfStreams) drives; Multiple Backup Chains: $(ConvertTo-TextYN $BackupMediaPool.MultiStreamingOptions.SplitJobFilesBetweenDrives)" 'Is WORM' = ConvertTo-TextYN $BackupMediaPool.Worm @@ -356,20 +351,20 @@ function Get-AbrVbrBackupToTape { } if ($BackupMediaPool.Type -eq "Custom") { $Vault = Switch (($TBkjob.IncrementalBackupMediaPool.Vault).count) { - 0 {"Disabled"} - default {$TBkjob.IncrementalBackupMediaPool.Vault} + 0 { "Disabled" } + default { $TBkjob.IncrementalBackupMediaPool.Vault } } $Retention = Switch ($TBkjob.IncrementalBackupMediaPool.RetentionPolicy.Type) { - $Null {"Disabled"} - 'Period' {"Protect data for $($TBkjob.IncrementalBackupMediaPool.RetentionPolicy.Value) $($TBkjob.IncrementalBackupMediaPool.RetentionPolicy.Period)"} - 'Cyclic' {'Do not protect data (cyclically overwrite tape as required)'} - 'Never' {'Never Overwrite Data'} + $Null { "Disabled" } + 'Period' { "Protect data for $($TBkjob.IncrementalBackupMediaPool.RetentionPolicy.Value) $($TBkjob.IncrementalBackupMediaPool.RetentionPolicy.Period)" } + 'Cyclic' { 'Do not protect data (cyclically overwrite tape as required)' } + 'Never' { 'Never Overwrite Data' } } $MediaSetPolicy = Switch ($TBkjob.IncrementalBackupMediaPool.MediaSetCreationPolicy.Type) { - $Null {"Disabled"} - 'Always' {"Create new media set for every backup session"} - 'Daily' {"Daily at $($TBkjob.IncrementalBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Period), $($TBkjob.IncrementalBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Type)"} - 'Never' {'Do not create, always continue using current media set'} + $Null { "Disabled" } + 'Always' { "Create new media set for every backup session" } + 'Daily' { "Daily at $($TBkjob.IncrementalBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Period), $($TBkjob.IncrementalBackupMediaPool.MediaSetCreationPolicy.DailyOptions.Type)" } + 'Never' { 'Do not create, always continue using current media set' } } $inObj.add('Retention', ($Retention)) $inObj.add('Export to Vault', (ConvertTo-TextYN $TBkjob.IncrementalBackupMediaPool.MoveOfflineToVault)) @@ -381,9 +376,8 @@ function Get-AbrVbrBackupToTape { } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Incremental Backup - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Incremental Backup - $($TBkjob.Name) Section: $($_.Exception.Message)" } } @@ -397,16 +391,15 @@ function Get-AbrVbrBackupToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Incremental Backup Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Incremental Backup Section: $($_.Exception.Message)" } } try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Options' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) options." + Write-PScriboMessage "Discovered $($TBkjob.Name) options." $inObj = [ordered] @{ 'Eject Tape Media Upon Job Completion' = ConvertTo-TextYN $TBkjob.EjectCurrentMedium 'Export the following MediaSet Upon Job Completion' = ConvertTo-TextYN $TBkjob.ExportCurrentMediaSet @@ -414,9 +407,8 @@ function Get-AbrVbrBackupToTape { } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Options - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Options - $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -433,15 +425,14 @@ function Get-AbrVbrBackupToTape { Section -Style NOTOCHeading6 -ExcludeFromTOC 'Advanced Settings (Notifications)' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) notification options." + Write-PScriboMessage "Discovered $($TBkjob.Name) notification options." $inObj = [ordered] @{ 'Send Email Notification' = ConvertTo-TextYN $TBkjob.NotificationOptions.EnableAdditionalNotification 'Email Notification Additional Recipients' = $TBkjob.NotificationOptions.AdditionalAddress -join "," } if (!$TBkjob.NotificationOptions.UseNotificationOptions) { $inObj.add('Use Global Notification Settings', (ConvertTo-TextYN $TBkjob.NotificationOptions.UseNotificationOptions)) - } - elseif ($TBkjob.NotificationOptions.UseNotificationOptions) { + } elseif ($TBkjob.NotificationOptions.UseNotificationOptions) { $inObj.add('Use Custom Notification Settings', ('Yes')) $inObj.add('Subject', ($TBkjob.NotificationOptions.NotificationSubject)) $inObj.add('Notify On Success', (ConvertTo-TextYN $TBkjob.NotificationOptions.NotifyOnSuccess)) @@ -451,9 +442,8 @@ function Get-AbrVbrBackupToTape { $inObj.add('Notify When Waiting For Tape', (ConvertTo-TextYN $TBkjob.NotificationOptions.NotifyWhenWaitingForTape)) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Notifications) - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Notifications) - $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -466,9 +456,8 @@ function Get-AbrVbrBackupToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Notifications) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Notifications) Section: $($_.Exception.Message)" } } if ($InfoLevel.Jobs.Tape -ge 2 -and $TBkjob.NotificationOptions.EnableAdditionalNotification) { @@ -476,38 +465,34 @@ function Get-AbrVbrBackupToTape { Section -Style NOTOCHeading6 -ExcludeFromTOC 'Advanced Settings (Advanced)' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) advanced options." + Write-PScriboMessage "Discovered $($TBkjob.Name) advanced options." $inObj = [ordered] @{ 'Process the most recent Restore Point instead of waiting' = ConvertTo-TextYN $TBkjob.AlwaysCopyFromLatestFull 'Use Hardware Compression when available' = ConvertTo-TextYN $TBkjob.UseHardwareCompression } if (!$TBkjob.JobScriptOptions.PreScriptEnabled) { $inObj.add('Pre Job Script Enabled', (ConvertTo-TextYN $TBkjob.JobScriptOptions.PreScriptEnabled)) - } - elseif ($TBkjob.JobScriptOptions.PreScriptEnabled) { + } elseif ($TBkjob.JobScriptOptions.PreScriptEnabled) { $inObj.add('Run the following script before job', ($TBkjob.JobScriptOptions.PreCommand)) } if (!$TBkjob.JobScriptOptions.PostScriptEnabled) { $inObj.add('Post Job Script Enabled', (ConvertTo-TextYN $TBkjob.JobScriptOptions.PostScriptEnabled)) - } - elseif ($TBkjob.JobScriptOptions.PostScriptEnabled) { + } elseif ($TBkjob.JobScriptOptions.PostScriptEnabled) { $inObj.add('Run the following script after job', ($TBkjob.JobScriptOptions.PostCommand)) } if ($TBkjob.JobScriptOptions.PreScriptEnabled -or $TBkjob.JobScriptOptions.PostScriptEnabled) { if ($TBkjob.JobScriptOptions.Periodicity -eq 'Days') { $FrequencyValue = $TBkjob.JobScriptOptions.Day -join ", " $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($TBkjob.JobScriptOptions.Periodicity -eq 'Cycles') { + } elseif ($TBkjob.JobScriptOptions.Periodicity -eq 'Cycles') { $FrequencyValue = "Every $($TBkjob.JobScriptOptions.Frequency) backup session" $FrequencyText = 'Run Script Every Backup Session' } $inObj.add($FrequencyText, ($FrequencyValue)) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Advanced) - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Advanced) - $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -520,21 +505,19 @@ function Get-AbrVbrBackupToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Advanced) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Advanced) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Options Section: $($_.Exception.Message)" } try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Schedule' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($TBkjob.Name) schedule options." $inObj = [ordered] @{ 'Prevent this job from being interrupted by source backup job' = ConvertTo-TextYN $TBkjob.WaitForBackupJobs } @@ -550,21 +533,18 @@ function Get-AbrVbrBackupToTape { if ($TBkjob.ScheduleOptions.Enabled -and !$TBkjob.GFSScheduleOptions) { if ($TBkjob.ScheduleOptions.Type -eq "Daily") { $Schedule = "Daily at this time: $($TBkjob.ScheduleOptions.DailyOptions.Period),`r`nDays: $($TBkjob.ScheduleOptions.DailyOptions.Type),`r`nDay Of Week: $($TBkjob.ScheduleOptions.DailyOptions.DayOfWeek)" - } - elseif ($TBkjob.ScheduleOptions.Type -eq "Monthly") { + } elseif ($TBkjob.ScheduleOptions.Type -eq "Monthly") { if ($TBkjob.ScheduleOptions.MonthlyOptions.DayNumberInMonth -eq 'OnDay') { $Schedule = "Monthly at this time: $($TBkjob.ScheduleOptions.MonthlyOptions.Period),`r`nThis Day: $($TBkjob.ScheduleOptions.MonthlyOptions.DayOfMonth),`r`nMonths: $($TBkjob.ScheduleOptions.MonthlyOptions.Months)" } else { $Schedule = "Monthly at this time: $($TBkjob.ScheduleOptions.MonthlyOptions.Period),`r`nDays Number of Month: $($TBkjob.ScheduleOptions.MonthlyOptions.DayNumberInMonth),`r`nDay Of Week: $($TBkjob.ScheduleOptions.MonthlyOptions.DayOfWeek),`r`nMonth: $($TBkjob.ScheduleOptions.MonthlyOptions.Months)" } - } - elseif ($TBkjob.ScheduleOptions.Type -eq "AfterJob") { + } elseif ($TBkjob.ScheduleOptions.Type -eq "AfterJob") { $Schedule = Switch ($TBkjob.ScheduleOptions.JobId) { - $Null {'Unknown'} - default {" After Job: $((Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.Id -eq $TBkjob.ScheduleOptions.JobId}).Name)"} + $Null { 'Unknown' } + default { " After Job: $((Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.Id -eq $TBkjob.ScheduleOptions.JobId}).Name)" } } - } - elseif ($TBkjob.ScheduleOptions.Type -eq "AfterNewBackup") { + } elseif ($TBkjob.ScheduleOptions.Type -eq "AfterNewBackup") { $Schedule = 'After New Backup File Appears' } $inObj.add("Run Automatically", ($Schedule)) @@ -575,9 +555,8 @@ function Get-AbrVbrBackupToTape { } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Schedule - $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Schedule - $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -590,18 +569,16 @@ function Get-AbrVbrBackupToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Schedule Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Schedule Section: $($_.Exception.Message)" } } } } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup To Tape Job Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup To Tape Job Configuration Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupjob.ps1 b/Src/Private/Get-AbrVbrBackupjob.ps1 index 83e83ab..086ac81 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.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,34 +21,33 @@ function Get-AbrVbrBackupjob { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Backup jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR Backup jobs information from $System." } process { try { - if (($Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -ne 'Windows Agent Backup' -and $_.TypeToString -ne 'Hyper-V Replication' -and $_.TypeToString -ne 'VMware Replication'} | Sort-Object -Property Name).count -gt 0) { + if (($Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -ne 'Windows Agent Backup' -and $_.TypeToString -ne 'Hyper-V Replication' -and $_.TypeToString -ne 'VMware Replication' } | Sort-Object -Property Name).count -gt 0) { $OutObj = @() foreach ($Bkjob in $Bkjobs) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) backup job." + Write-PScriboMessage "Discovered $($Bkjob.Name) backup job." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString 'Status' = Switch ($Bkjob.IsScheduleEnabled) { - 'False' {'Disabled'} - 'True' {'Enabled'} + 'False' { 'Disabled' } + 'True' { 'Enabled' } } 'Latest Result' = $Bkjob.info.LatestStatus 'Scheduled?' = Switch ($Bkjob.IsScheduleEnabled) { - 'True' {'Yes'} - 'False' {'No'} - default {'Unknown'} + 'True' { 'Yes' } + 'False' { 'No' } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Backup Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Jobs Section: $($_.Exception.Message)" } } @@ -83,7 +82,7 @@ function Get-AbrVbrBackupjob { $chartFileItem = Get-ColumnChart -SampleData $sampleData -ChartName 'BackupJobs' -XField 'Name' -YField 'Count' -ChartAreaName 'Infrastructure' -AxisXTitle 'Status' -AxisYTitle 'Count' -ChartTitleName 'BackupJobs' -ChartTitleText 'Jobs Latest Result' } catch { - Write-PscriboMessage -IsWarning "Backup Jobs chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Backup Jobs chart section: $($_.Exception.Message)" } if ($OutObj) { if ($chartFileItem) { @@ -92,13 +91,12 @@ function Get-AbrVbrBackupjob { 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 } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Jobs Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupjobHyperV.ps1 b/Src/Private/Get-AbrVbrBackupjobHyperV.ps1 index 09c8a41..7443b91 100644 --- a/Src/Private/Get-AbrVbrBackupjobHyperV.ps1 +++ b/Src/Private/Get-AbrVbrBackupjobHyperV.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupjobHyperV { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,32 +21,31 @@ function Get-AbrVbrBackupjobHyperV { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Hyper-V Backup jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR Hyper-V Backup jobs information from $System." } process { try { - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.TypeToString -eq "Hyper-V Backup" -or $_.TypeToString -eq "Hyper-V Backup Copy"} | Sort-Object -Property Name + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq "Hyper-V Backup" -or $_.TypeToString -eq "Hyper-V Backup Copy" } | Sort-Object -Property Name if (($Bkjobs).count -gt 0) { Section -Style Heading3 'Hyper-V Backup Jobs Configuration' { Paragraph "The following section details the configuration of the Hyper-V type backup jobs." BlankLine $OutObj = @() try { - $VMcounts = Get-VBRBackup | Where-Object {$_.TypeToString -eq "Hyper-V Backup" -or $_.TypeToString -eq "Hyper-V Backup Copy"} + $VMcounts = Get-VBRBackup | Where-Object { $_.TypeToString -eq "Hyper-V Backup" -or $_.TypeToString -eq "Hyper-V Backup Copy" } if ($VMcounts) { foreach ($VMcount in $VMcounts) { try { - Write-PscriboMessage "Discovered $($VMcount.Name) ." + Write-PScriboMessage "Discovered $($VMcount.Name) ." $inObj = [ordered] @{ 'Name' = $VMcount.Name 'Creation Time' = $VMcount.CreationTime 'VM Count' = $VMcount.VmCount } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" } } @@ -60,9 +59,8 @@ function Get-AbrVbrBackupjobHyperV { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" } $OutObj = @() foreach ($Bkjob in $Bkjobs) { @@ -71,10 +69,10 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading4 -ExcludeFromTOC 'Common Information' { $OutObj = @() try { - $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue -Name $Bkjob.Name | Where-object {$_.TypeToString -ne 'Windows Agent Backup'}).Info + $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue -Name $Bkjob.Name | Where-Object { $_.TypeToString -ne 'Windows Agent Backup' }).Info foreach ($CommonInfo in $CommonInfos) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) common information." + Write-PScriboMessage "Discovered $($Bkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString @@ -85,9 +83,8 @@ function Get-AbrVbrBackupjobHyperV { 'Modified By' = $CommonInfo.CommonInfo.ModifiedBy.FullName } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Common Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Common Information Section: $($_.Exception.Message)" } } @@ -106,7 +103,7 @@ function Get-AbrVbrBackupjobHyperV { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -115,9 +112,8 @@ function Get-AbrVbrBackupjobHyperV { } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Common Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Common Information Section: $($_.Exception.Message)" } } if ($Bkjob.LinkedJobs) { @@ -126,8 +122,8 @@ function Get-AbrVbrBackupjobHyperV { try { foreach ($LinkedBkJob in $Bkjob.LinkedJobs) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) linked backup job." - $Job = Get-VBRJob -WarningAction SilentlyContinue| Where-Object {$_.Id -eq $LinkedBkJob.info.LinkedObjectId} + Write-PScriboMessage "Discovered $($Bkjob.Name) linked backup job." + $Job = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.Id -eq $LinkedBkJob.info.LinkedObjectId } $inObj = [ordered] @{ 'Name' = $Job.Name 'Type' = $Job.TypeToString @@ -135,9 +131,8 @@ function Get-AbrVbrBackupjobHyperV { 'Repository' = $Job.GetTargetRepository().Name } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Linked Backup Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Linked Backup Jobs Section: $($_.Exception.Message)" } } @@ -150,9 +145,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Linked Backup Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Linked Backup Jobs Section: $($_.Exception.Message)" } } } @@ -161,38 +155,35 @@ function Get-AbrVbrBackupjobHyperV { $OutObj = @() try { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) data transfer." + Write-PScriboMessage "Discovered $($Bkjob.Name) data transfer." if ($Bkjob.IsWanAcceleratorEnabled()) { try { $TargetWanAccelerator = $Bkjob.GetTargetWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $SourceWanAccelerator = $Bkjob.GetSourceWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $inObj = [ordered] @{ 'Use Wan accelerator' = ConvertTo-TextYN $Bkjob.IsWanAcceleratorEnabled() 'Source Wan accelerator' = Switch ($Bkjob.IsWanAcceleratorEnabled()) { - 'False' {'Direct Mode'} - 'True' {$SourceWanAccelerator} - default {'Unknown'} + 'False' { 'Direct Mode' } + 'True' { $SourceWanAccelerator } + default { 'Unknown' } } 'Target Wan accelerator' = Switch ($Bkjob.IsWanAcceleratorEnabled()) { - 'False' {'Direct Mode'} - 'True' {$TargetWanAccelerator} - default {'Unknown'} + 'False' { 'Direct Mode' } + 'True' { $TargetWanAccelerator } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Data Transfer Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Data Transfer Section: $($_.Exception.Message)" } $TableParams = @{ @@ -204,9 +195,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Data Transfer Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Data Transfer Section: $($_.Exception.Message)" } } } @@ -214,8 +204,8 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading5 -ExcludeFromTOC "Virtual Machines" { $OutObj = @() try { - foreach ($OBJ in ($Bkjob.GetObjectsInJob() | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "Exclude"} )) { - Write-PscriboMessage "Discovered $($OBJ.Name) object to backup." + foreach ($OBJ in ($Bkjob.GetObjectsInJob() | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "Exclude" } )) { + Write-PScriboMessage "Discovered $($OBJ.Name) object to backup." $inObj = [ordered] @{ 'Name' = $OBJ.Object.Name 'Resource Type' = $OBJ.Object.Info.Type @@ -235,37 +225,35 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Virtual Machine Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Virtual Machine Section: $($_.Exception.Message)" } } } if ($Bkjob.TypeToString -eq "Hyper-V Backup Copy") { $Storage = 'Target' - } else {$Storage = 'Storage'} + } else { $Storage = 'Storage' } Section -Style NOTOCHeading5 -ExcludeFromTOC $Storage { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." if ($Bkjob.BackupStorageOptions.RetentionType -eq "Days") { $RetainString = 'Retain Days To Keep' $Retains = $Bkjob.BackupStorageOptions.RetainDaysToKeep - } - elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { + } elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { $RetainString = 'Retain Cycles' $Retains = $Bkjob.BackupStorageOptions.RetainCycles } $inObj = [ordered] @{ 'Backup Proxy' = Switch (($Bkjob.GetProxy().Name).count) { - 0 {"Unknown"} - {$_ -gt 1} {"Automatic"} - default {$Bkjob.GetProxy().Name} + 0 { "Unknown" } + { $_ -gt 1 } { "Automatic" } + default { $Bkjob.GetProxy().Name } } 'Backup 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} + '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 } } 'Retention Type' = $Bkjob.BackupStorageOptions.RetentionType $RetainString = $Retains @@ -274,8 +262,8 @@ function Get-AbrVbrBackupjobHyperV { 'Integrity Checks' = ConvertTo-TextYN $Bkjob.BackupStorageOptions.EnableIntegrityChecks 'Storage Encryption' = ConvertTo-TextYN $Bkjob.BackupStorageOptions.StorageEncryptionEnabled 'Backup Mode' = Switch ($Bkjob.Options.BackupTargetOptions.Algorithm) { - 'Syntethic' {"Reverse Incremental"} - 'Increment' {'Incremental'} + 'Syntethic' { "Reverse Incremental" } + 'Increment' { 'Incremental' } } 'Active Full Backup Schedule Kind' = $Bkjob.Options.BackupTargetOptions.FullBackupScheduleKind 'Active Full Backup Days' = $Bkjob.Options.BackupTargetOptions.FullBackupDays @@ -286,7 +274,7 @@ function Get-AbrVbrBackupjobHyperV { } if ($Bkjob.Options.GfsPolicy.IsEnabled) { - $inObj.add('Keep certain full backup longer for archival purposes (GFS)',(ConvertTo-TextYN $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 { @@ -318,7 +306,7 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($Bkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $Bkjob.Options.GenerationPolicy.EnableRechek 'SLCG Schedule Type' = $Bkjob.Options.GenerationPolicy.RecheckScheduleKind @@ -355,9 +343,8 @@ function Get-AbrVbrBackupjobHyperV { } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Storage Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Storage Options Section: $($_.Exception.Message)" } } } @@ -365,38 +352,38 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Storage)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." $inObj = [ordered] @{ 'Inline Data Deduplication' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.EnableDeduplication 'Exclude Swap Files Block' = ConvertTo-TextYN $Bkjob.HvSourceOptions.ExcludeSwapFile 'Exclude Deleted Files Block' = ConvertTo-TextYN $Bkjob.HvSourceOptions.DirtyBlocksNullingEnabled 'Compression Level' = Switch ($Bkjob.Options.BackupStorageOptions.CompressionLevel) { - 0 {'NONE'} - -1 {'AUTO'} - 4 {'DEDUPE_friendly'} - 5 {'OPTIMAL (Default)'} - 6 {'High'} - 9 {'EXTREME'} + 0 { 'NONE' } + -1 { 'AUTO' } + 4 { 'DEDUPE_friendly' } + 5 { 'OPTIMAL (Default)' } + 6 { 'High' } + 9 { 'EXTREME' } } 'Storage optimization' = Switch ($Bkjob.Options.BackupStorageOptions.StgBlockSize) { - 'KbBlockSize1024' {'Local target'} - 'KbBlockSize512' {'LAN target'} - 'KbBlockSize256' {'WAN target'} - 'KbBlockSize4096' {'Local target (large blocks)'} - default {$Bkjob.Options.BackupStorageOptions.StgBlockSize} + 'KbBlockSize1024' { 'Local target' } + 'KbBlockSize512' { 'LAN target' } + 'KbBlockSize256' { 'WAN target' } + 'KbBlockSize4096' { 'Local target (large blocks)' } + default { $Bkjob.Options.BackupStorageOptions.StgBlockSize } } 'Enabled Backup File Encryption' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled 'Encryption Key' = Switch ($Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled) { - $false {'None'} - default {(Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description} + $false { 'None' } + default { (Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Jobs.BestPractice) { - $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' - $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Swap Files Block' - $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' + $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' + $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Swap Files Block' + $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' } $TableParams = @{ @@ -409,18 +396,17 @@ function Get-AbrVbrBackupjobHyperV { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' }) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Backup and replica data is a high potential source of vulnerability. To secure data stored in backups and replicas, use Veeam Backup & Replication inbuilt encryption to protect data in backups" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Storage) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Storage) Section: $($_.Exception.Message)" } } } @@ -428,7 +414,7 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) notification options." + Write-PScriboMessage "Discovered $($Bkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SnmpNotification 'Send Email Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SendEmailNotification2AdditionalAddresses @@ -455,9 +441,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Notification) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Notification) Section: $($_.Exception.Message)" } } } @@ -465,7 +450,7 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Hyper-V)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Hyper-V options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Hyper-V options." $inObj = [ordered] @{ 'Enable Hyper-V Guest Quiescence' = ConvertTo-TextYN $Bkjob.Options.HvSourceOptions.EnableHvQuiescence 'Crash Consistent Backup' = ConvertTo-TextYN $Bkjob.Options.HvSourceOptions.CanDoCrashConsistent @@ -483,9 +468,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Hyper-V) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Hyper-V) Section: $($_.Exception.Message)" } } } @@ -493,7 +477,7 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Integration)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Integration options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Integration options." $inObj = [ordered] @{ 'Enable Backup from Storage Snapshots' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.UseSanSnapshots 'Limit processed VM count per Storage Snapshot' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.MultipleStorageSnapshotEnabled @@ -512,9 +496,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Integration) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Integration) Section: $($_.Exception.Message)" } } } @@ -525,12 +508,11 @@ function Get-AbrVbrBackupjobHyperV { if ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Days') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Days -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { + } elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($Bkjob.Name) script options." + Write-PScriboMessage "Discovered $($Bkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $Bkjob.Options.JobScriptCommand.PreScriptEnabled 'Run Script Before the Job' = $Bkjob.Options.JobScriptCommand.PreScriptCommandLine @@ -551,9 +533,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Script) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (Script) Section: $($_.Exception.Message)" } } } @@ -561,7 +542,7 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (RPO Monitor)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) rpo monitor options." + Write-PScriboMessage "Discovered $($Bkjob.Name) rpo monitor options." $inObj = [ordered] @{ 'RPO Monitor Enabled' = ConvertTo-TextYN $Bkjob.Options.RpoOptions.Enabled 'If Backup is not Copied Within' = "$($Bkjob.Options.RpoOptions.Value) $($Bkjob.Options.RpoOptions.TimeUnit)" @@ -579,24 +560,22 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (RPO Monitor) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Advanced Settings (RPO Monitor) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Storage Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Storage Options Section: $($_.Exception.Message)" } } - $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($Bkjob.Id) | Where-Object {$_.JobType -ne 'SimpleBackupCopyWorker'} + $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($Bkjob.Id) | Where-Object { $_.JobType -ne 'SimpleBackupCopyWorker' } if ($SecondaryTargets) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Secondary Target" { $OutObj = @() try { foreach ($SecondaryTarget in $SecondaryTargets) { - Write-PscriboMessage "Discovered $($Bkjob.Name) secondary target." + Write-PScriboMessage "Discovered $($Bkjob.Name) secondary target." try { $inObj = [ordered] @{ 'Job Name' = $SecondaryTarget.Name @@ -605,9 +584,8 @@ function Get-AbrVbrBackupjobHyperV { 'Description' = $SecondaryTarget.Description } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Secondary Target Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Secondary Target Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -619,9 +597,8 @@ function Get-AbrVbrBackupjobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Job Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Secondary Target Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Secondary Target Section: $($_.Exception.Message)" } } } @@ -629,40 +606,40 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading5 -ExcludeFromTOC "Guest Processing" { $OutObj = @() try { - $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "VssChild"} + $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "VssChild" } foreach ($VSSObj in $VSSObjs) { - Write-PscriboMessage "Discovered $($Bkjob.Name) guest processing." + Write-PScriboMessage "Discovered $($Bkjob.Name) guest processing." $inObj = [ordered] @{ 'Name' = $VSSObj.Name '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 + '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 - 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}).count) { - 0 {'None'} - Default {Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}} + 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid }).count) { + 0 { 'None' } + Default { Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid } } } 'Object Credential' = Switch ($VSSObj.VssOptions.WinCredsId.Guid) { - '00000000-0000-0000-0000-000000000000' {'Default Credential'} - default {Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid}} + '00000000-0000-0000-0000-000000000000' { 'Default Credential' } + default { Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid } } } 'Application Processing' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.ApplicationProcessingEnabled 'Transaction Logs' = Switch ($VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { - 'False' {'Process Transaction Logs'} - 'True' {'Perform Copy Only'} + 'False' { 'Process Transaction Logs' } + 'True' { 'Perform Copy Only' } } 'Use Persistent Guest Agent' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.UsePersistentGuestAgent } if ($InfoLevel.Jobs.Backup -ge 2) { if (!$VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { $TransactionLogsProcessing = Switch ($VSSObj.VssOptions.SqlBackupOptions.TransactionLogsProcessing) { - 'TruncateOnlyOnSuccessJob' {'Truncate logs'} - 'Backup' {'Backup logs periodically'} - 'NeverTruncate' {'Do not truncate logs'} + 'TruncateOnlyOnSuccessJob' { 'Truncate logs' } + 'Backup' { 'Backup logs periodically' } + 'NeverTruncate' { 'Do not truncate logs' } } $RetainLogBackups = Switch ($VSSObj.VssOptions.SqlBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups" } } $inObj.add('SQL Transaction Logs Processing', ($TransactionLogsProcessing)) $inObj.add('SQL Backup Log Every', ("$($VSSObj.VssOptions.SqlBackupOptions.BackupLogsFrequencyMin) min")) @@ -670,18 +647,18 @@ function Get-AbrVbrBackupjobHyperV { } if ($VSSObj.VssOptions.OracleBackupOptions.BackupLogsEnabled -or $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { $ArchivedLogsTruncation = Switch ($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { - 'ByAge' {"Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours"} - 'BySize' {"Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB"} - default {$VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation} + 'ByAge' { "Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours" } + 'BySize' { "Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB" } + default { $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation } } $SysdbaCredsId = Switch ($VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId) { - '00000000-0000-0000-0000-000000000000' {'Guest OS Credential'} - default {(Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId}).Description} + '00000000-0000-0000-0000-000000000000' { 'Guest OS Credential' } + default { (Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId }).Description } } $RetainLogBackups = Switch ($VSSObj.VssOptions.OracleBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups" } } $inObj.add('Oracle Account Type', $VSSObj.VssOptions.OracleBackupOptions.AccountType) $inObj.add('Oracle Sysdba Creds', $SysdbaCredsId) @@ -695,24 +672,22 @@ function Get-AbrVbrBackupjobHyperV { $inObj.add('File Exclusions', (ConvertTo-TextYN $VSSObj.VssOptions.GuestFSExcludeOptions.FileExcludeEnabled)) if ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'ExcludeSpecifiedFolders') { $inObj.add('Exclude the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.ExcludeList -join ',')) - } - elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { - $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList-join ',')) + } elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { + $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList -join ',')) } } if ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode -ne 'Disabled') { $ScriptingMode = Switch ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode) { - 'FailJobOnError' {'Require successfull script execution'} - 'IgnoreErrors' {'Ignore script execution failures'} - 'Disabled' {'Disable script execution'} + 'FailJobOnError' { 'Require successfull script execution' } + 'IgnoreErrors' { 'Ignore script execution failures' } + 'Disabled' { 'Disable script execution' } } $inObj.add('Scripts', (ConvertTo-TextYN $VSSObj.VssOptions.GuestScriptsOptions.IsAtLeastOneScriptSet)) $inObj.add('Scripts Mode', ($ScriptingMode)) if ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Windows Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PreScriptFilePath)) $inObj.add('Windows Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PostScriptFilePath)) - } - elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { + } elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Linux Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PreScriptFilePath)) $inObj.add('Linux Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PostScriptFilePath)) } @@ -731,9 +706,8 @@ function Get-AbrVbrBackupjobHyperV { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Guest Processing Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Guest Processing Section: $($_.Exception.Message)" } } } @@ -741,20 +715,17 @@ function Get-AbrVbrBackupjobHyperV { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." if ($Bkjob.ScheduleOptions.OptionsDaily.Enabled -eq "True") { $ScheduleType = "Daily" $Schedule = "Kind: $($Bkjob.ScheduleOptions.OptionsDaily.Kind),`r`nDays: $($Bkjob.ScheduleOptions.OptionsDaily.DaysSrv)" - } - elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfMonth),`r`nDay Number In Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayNumberInMonth),`r`nDay Of Week: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfWeek)" - } - elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { $ScheduleType = $Bkjob.ScheduleOptions.OptionsPeriodically.Kind $Schedule = "Full Period: $($Bkjob.ScheduleOptions.OptionsPeriodically.FullPeriod),`r`nHourly Offset: $($Bkjob.ScheduleOptions.OptionsPeriodically.HourlyOffset),`r`nUnit: $($Bkjob.ScheduleOptions.OptionsPeriodically.Unit)" - } - elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { $ScheduleType = 'Continuous' $Schedule = "Schedule Time Period" } @@ -762,13 +733,13 @@ function Get-AbrVbrBackupjobHyperV { 'Retry Failed item' = $Bkjob.ScheduleOptions.RetryTimes 'Wait before each retry' = "$($Bkjob.ScheduleOptions.RetryTimeout)/min" 'Backup Window' = Switch ($Bkjob.TypeToString) { - "Hyper-V Backup Copy" {ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsContinuous.Enabled} - default {ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled} + "Hyper-V Backup Copy" { ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsContinuous.Enabled } + default { ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled } } 'Shedule type' = $ScheduleType 'Shedule Options' = $Schedule - 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() - 'Latest Run' = $Bkjob.LatestRunLocal + 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() + 'Latest Run' = $Bkjob.LatestRunLocal } $OutObj = [pscustomobject]$inobj @@ -797,10 +768,9 @@ function Get-AbrVbrBackupjobHyperV { $Regex = [Regex]::new("(?<=<$Day>)(.*)(?=)") if ($Bkjob.TypeToString -eq "VMware Backup Copy") { $BackupWindow = $Bkjob.ScheduleOptions.OptionsContinuous.Schedule - } else {$BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow} + } else { $BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow } $Match = $Regex.Match($BackupWindow) - if($Match.Success) - { + if ($Match.Success) { $ScheduleTimePeriod += $Match.Value } } @@ -810,7 +780,7 @@ function Get-AbrVbrBackupjobHyperV { $TableParams = @{ Name = "Backup Window - $($Bkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -818,46 +788,42 @@ function Get-AbrVbrBackupjobHyperV { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style ON -Property "Sat" - - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style OFF -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style ON -Property "Sat" + + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style OFF -Property "Sat" $OutObj2 } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Schedule Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Schedule Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Schedule Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Schedule Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Backup Jobs Configuration Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrBackupjobVMware.ps1 b/Src/Private/Get-AbrVbrBackupjobVMware.ps1 index 5388b62..157c23e 100644 --- a/Src/Private/Get-AbrVbrBackupjobVMware.ps1 +++ b/Src/Private/Get-AbrVbrBackupjobVMware.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrBackupjobVMware { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,32 +21,31 @@ function Get-AbrVbrBackupjobVMware { ) begin { - Write-PscriboMessage "Discovering Veeam VBR VMware Backup jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR VMware Backup jobs information from $System." } process { try { - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.TypeToString -eq "VMware Backup" -or $_.TypeToString -eq "VMware Backup Copy" -or $_.TypeToString -eq "VM Copy"} | Sort-Object -Property Name + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq "VMware Backup" -or $_.TypeToString -eq "VMware Backup Copy" -or $_.TypeToString -eq "VM Copy" } | Sort-Object -Property Name if (($Bkjobs).count -gt 0) { Section -Style Heading3 'VMware Backup Jobs Configuration' { Paragraph "The following section details the configuration of VMware type backup jobs." BlankLine $OutObj = @() try { - $VMcounts = Get-VBRBackup | Where-Object {$_.TypeToString -eq "VMware Backup" -or $_.TypeToString -eq "VMware Backup Copy" -or $_.TypeToString -eq "VM Copy"} + $VMcounts = Get-VBRBackup | Where-Object { $_.TypeToString -eq "VMware Backup" -or $_.TypeToString -eq "VMware Backup Copy" -or $_.TypeToString -eq "VM Copy" } if ($VMcounts) { foreach ($VMcount in $VMcounts) { try { - Write-PscriboMessage "Discovered $($VMcount.Name) ." + Write-PScriboMessage "Discovered $($VMcount.Name) ." $inObj = [ordered] @{ 'Name' = $VMcount.Name 'Creation Time' = $VMcount.CreationTime 'VM Count' = $VMcount.VmCount } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Backup Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Backup Jobs Configuration Section: $($_.Exception.Message)" } } @@ -60,9 +59,8 @@ function Get-AbrVbrBackupjobVMware { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } $OutObj = @() foreach ($Bkjob in $Bkjobs) { @@ -71,10 +69,10 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading4 -ExcludeFromTOC 'Common Information' { $OutObj = @() try { - $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue -Name $Bkjob.Name | Where-object {$_.TypeToString -ne 'Windows Agent Backup'}).Info + $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue -Name $Bkjob.Name | Where-Object { $_.TypeToString -ne 'Windows Agent Backup' }).Info foreach ($CommonInfo in $CommonInfos) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) common information." + Write-PScriboMessage "Discovered $($Bkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString @@ -85,9 +83,8 @@ function Get-AbrVbrBackupjobVMware { 'Modified By' = $CommonInfo.CommonInfo.ModifiedBy.FullName } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -106,7 +103,7 @@ function Get-AbrVbrBackupjobVMware { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -115,9 +112,8 @@ function Get-AbrVbrBackupjobVMware { } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Bkjob.LinkedJobs) { @@ -126,8 +122,8 @@ function Get-AbrVbrBackupjobVMware { try { foreach ($LinkedBkJob in $Bkjob.LinkedJobs) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) linked backup job." - $Job = Get-VBRJob -WarningAction SilentlyContinue| Where-Object {$_.Id -eq $LinkedBkJob.info.LinkedObjectId} + Write-PScriboMessage "Discovered $($Bkjob.Name) linked backup job." + $Job = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.Id -eq $LinkedBkJob.info.LinkedObjectId } $inObj = [ordered] @{ 'Name' = $Job.Name 'Type' = $Job.TypeToString @@ -135,9 +131,8 @@ function Get-AbrVbrBackupjobVMware { 'Repository' = $Job.GetTargetRepository().Name } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -150,9 +145,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -162,9 +156,9 @@ function Get-AbrVbrBackupjobVMware { try { foreach ($LinkedRepository in $Bkjob.LinkedRepositories.LinkedRepositoryId) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) linked repository." - $Repo = Get-VBRBackupRepository | Where-Object {$_.Id -eq $LinkedRepository} - $ScaleRepo = Get-VBRBackupRepository -ScaleOut | Where-Object {$_.Id -eq $LinkedRepository} + Write-PScriboMessage "Discovered $($Bkjob.Name) linked repository." + $Repo = Get-VBRBackupRepository | Where-Object { $_.Id -eq $LinkedRepository } + $ScaleRepo = Get-VBRBackupRepository -ScaleOut | Where-Object { $_.Id -eq $LinkedRepository } if ($Repo) { $inObj = [ordered] @{ 'Name' = $Repo.Name @@ -180,9 +174,8 @@ function Get-AbrVbrBackupjobVMware { } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -195,9 +188,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -206,38 +198,35 @@ function Get-AbrVbrBackupjobVMware { $OutObj = @() try { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) data transfer." + Write-PScriboMessage "Discovered $($Bkjob.Name) data transfer." if ($Bkjob.IsWanAcceleratorEnabled()) { try { $TargetWanAccelerator = $Bkjob.GetTargetWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $SourceWanAccelerator = $Bkjob.GetSourceWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $inObj = [ordered] @{ 'Use Wan accelerator' = ConvertTo-TextYN $Bkjob.IsWanAcceleratorEnabled() 'Source Wan accelerator' = Switch ($Bkjob.IsWanAcceleratorEnabled()) { - 'False' {'Direct Mode'} - 'True' {$SourceWanAccelerator} - default {'Unknown'} + 'False' { 'Direct Mode' } + 'True' { $SourceWanAccelerator } + default { 'Unknown' } } 'Target Wan accelerator' = Switch ($Bkjob.IsWanAcceleratorEnabled()) { - 'False' {'Direct Mode'} - 'True' {$TargetWanAccelerator} - default {'Unknown'} + 'False' { 'Direct Mode' } + 'True' { $TargetWanAccelerator } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } $TableParams = @{ @@ -249,9 +238,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -259,8 +247,8 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading5 -ExcludeFromTOC "Virtual Machines" { $OutObj = @() try { - foreach ($OBJ in ($Bkjob.GetViOijs() | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "Exclude"} )) { - Write-PscriboMessage "Discovered $($OBJ.Name) object to backup." + foreach ($OBJ in ($Bkjob.GetViOijs() | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "Exclude" } )) { + Write-PScriboMessage "Discovered $($OBJ.Name) object to backup." $inObj = [ordered] @{ 'Name' = $OBJ.Name 'Resource Type' = $OBJ.TypeDisplayName @@ -280,37 +268,35 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } if ($Bkjob.TypeToString -eq "VMware Backup Copy") { $Storage = 'Target' - } else {$Storage = 'Storage'} + } else { $Storage = 'Storage' } Section -Style NOTOCHeading5 -ExcludeFromTOC $Storage { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." if ($Bkjob.BackupStorageOptions.RetentionType -eq "Days") { $RetainString = 'Retain Days To Keep' $Retains = $Bkjob.BackupStorageOptions.RetainDaysToKeep - } - elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { + } elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { $RetainString = 'Retain Cycles' $Retains = $Bkjob.BackupStorageOptions.RetainCycles } $inObj = [ordered] @{ 'Backup Proxy' = Switch (($Bkjob.GetProxy().Name).count) { - 0 {"Unknown"} - {$_ -gt 1} {"Automatic"} - default {$Bkjob.GetProxy().Name} + 0 { "Unknown" } + { $_ -gt 1 } { "Automatic" } + default { $Bkjob.GetProxy().Name } } 'Backup 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} + '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 } } 'Retention Type' = $Bkjob.BackupStorageOptions.RetentionType $RetainString = $Retains @@ -319,8 +305,8 @@ function Get-AbrVbrBackupjobVMware { 'Integrity Checks' = ConvertTo-TextYN $Bkjob.BackupStorageOptions.EnableIntegrityChecks 'Storage Encryption' = ConvertTo-TextYN $Bkjob.BackupStorageOptions.StorageEncryptionEnabled 'Backup Mode' = Switch ($Bkjob.Options.BackupTargetOptions.Algorithm) { - 'Synthetic' {"Reverse Incremental"} - 'Increment' {'Incremental'} + 'Synthetic' { "Reverse Incremental" } + 'Increment' { 'Incremental' } } 'Active Full Backup Schedule Kind' = $Bkjob.Options.BackupTargetOptions.FullBackupScheduleKind 'Active Full Backup Days' = $Bkjob.Options.BackupTargetOptions.FullBackupDays @@ -331,7 +317,7 @@ function Get-AbrVbrBackupjobVMware { } if ($Bkjob.Options.GfsPolicy.IsEnabled) { - $inObj.add('Keep certain full backup longer for archival purposes (GFS)',(ConvertTo-TextYN $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 { @@ -363,7 +349,7 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($Bkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $Bkjob.Options.GenerationPolicy.EnableRechek 'SLCG Schedule Type' = $Bkjob.Options.GenerationPolicy.RecheckScheduleKind @@ -400,9 +386,8 @@ function Get-AbrVbrBackupjobVMware { } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -410,38 +395,38 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Storage)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." $inObj = [ordered] @{ 'Inline Data Deduplication' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.EnableDeduplication 'Exclude Swap Files Block' = ConvertTo-TextYN $Bkjob.ViSourceOptions.ExcludeSwapFile 'Exclude Deleted Files Block' = ConvertTo-TextYN $Bkjob.ViSourceOptions.DirtyBlocksNullingEnabled 'Compression Level' = Switch ($Bkjob.Options.BackupStorageOptions.CompressionLevel) { - 0 {'NONE'} - -1 {'AUTO'} - 4 {'DEDUPE_friendly'} - 5 {'OPTIMAL (Default)'} - 6 {'High'} - 9 {'EXTREME'} + 0 { 'NONE' } + -1 { 'AUTO' } + 4 { 'DEDUPE_friendly' } + 5 { 'OPTIMAL (Default)' } + 6 { 'High' } + 9 { 'EXTREME' } } 'Storage optimization' = Switch ($Bkjob.Options.BackupStorageOptions.StgBlockSize) { - 'KbBlockSize1024' {'Local target'} - 'KbBlockSize512' {'LAN target'} - 'KbBlockSize256' {'WAN target'} - 'KbBlockSize4096' {'Local target (large blocks)'} - default {$Bkjob.Options.BackupStorageOptions.StgBlockSize} + 'KbBlockSize1024' { 'Local target' } + 'KbBlockSize512' { 'LAN target' } + 'KbBlockSize256' { 'WAN target' } + 'KbBlockSize4096' { 'Local target (large blocks)' } + default { $Bkjob.Options.BackupStorageOptions.StgBlockSize } } 'Enabled Backup File Encryption' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled 'Encryption Key' = Switch ($Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled) { - $false {'None'} - default {(Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description} + $false { 'None' } + default { (Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Jobs.BestPractice) { - $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' - $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Swap Files Block' - $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' + $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' + $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Swap Files Block' + $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' } $TableParams = @{ @@ -454,18 +439,17 @@ function Get-AbrVbrBackupjobVMware { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' }) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Backup and replica data is a high potential source of vulnerability. To secure data stored in backups and replicas, use Veeam Backup & Replication inbuilt encryption to protect data in backups" } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -473,7 +457,7 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) notification options." + Write-PScriboMessage "Discovered $($Bkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SnmpNotification 'Send Email Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SendEmailNotification2AdditionalAddresses @@ -500,9 +484,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -510,7 +493,7 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (vSphere)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) vSphere options." + Write-PScriboMessage "Discovered $($Bkjob.Name) vSphere options." $inObj = [ordered] @{ 'Enable VMware Tools Quiescence' = ConvertTo-TextYN $Bkjob.Options.ViSourceOptions.VMToolsQuiesce 'Use Change Block Tracking' = ConvertTo-TextYN $Bkjob.Options.ViSourceOptions.UseChangeTracking @@ -528,9 +511,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -538,7 +520,7 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Integration)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Integration options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Integration options." $inObj = [ordered] @{ 'Enable Backup from Storage Snapshots' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.UseSanSnapshots 'Limit processed VM count per Storage Snapshot' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.MultipleStorageSnapshotEnabled @@ -557,9 +539,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -570,12 +551,11 @@ function Get-AbrVbrBackupjobVMware { if ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Days') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Days -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { + } elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($Bkjob.Name) script options." + Write-PScriboMessage "Discovered $($Bkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $Bkjob.Options.JobScriptCommand.PreScriptEnabled 'Run Script Before the Job' = $Bkjob.Options.JobScriptCommand.PreScriptCommandLine @@ -596,9 +576,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -606,7 +585,7 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (RPO Monitor)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) rpo monitor options." + Write-PScriboMessage "Discovered $($Bkjob.Name) rpo monitor options." $inObj = [ordered] @{ 'RPO Monitor Enabled' = ConvertTo-TextYN $Bkjob.Options.RpoOptions.Enabled 'If Backup is not Copied Within' = "$($Bkjob.Options.RpoOptions.Value) $($Bkjob.Options.RpoOptions.TimeUnit)" @@ -624,24 +603,22 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $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 } } - $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($Bkjob.Id) | Where-Object {$_.JobType -ne 'SimpleBackupCopyWorker'} + $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($Bkjob.Id) | Where-Object { $_.JobType -ne 'SimpleBackupCopyWorker' } if ($SecondaryTargets) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Secondary Target" { $OutObj = @() try { foreach ($SecondaryTarget in $SecondaryTargets) { - Write-PscriboMessage "Discovered $($Bkjob.Name) secondary target." + Write-PScriboMessage "Discovered $($Bkjob.Name) secondary target." try { $inObj = [ordered] @{ 'Job Name' = $SecondaryTarget.Name @@ -650,9 +627,8 @@ function Get-AbrVbrBackupjobVMware { 'Description' = $SecondaryTarget.Description } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -664,9 +640,8 @@ function Get-AbrVbrBackupjobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Job Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -674,40 +649,40 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading5 -ExcludeFromTOC "Guest Processing" { $OutObj = @() try { - $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "VssChild"} + $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "VssChild" } foreach ($VSSObj in $VSSObjs) { - Write-PscriboMessage "Discovered $($Bkjob.Name) guest processing." + Write-PScriboMessage "Discovered $($Bkjob.Name) guest processing." $inObj = [ordered] @{ 'Name' = $VSSObj.Name '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 + '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 - 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}).count) { - 0 {'None'} - Default {Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}} + 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid }).count) { + 0 { 'None' } + Default { Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid } } } 'Object Credential' = Switch ($VSSObj.VssOptions.WinCredsId.Guid) { - '00000000-0000-0000-0000-000000000000' {'Default Credential'} - default {Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid}} + '00000000-0000-0000-0000-000000000000' { 'Default Credential' } + default { Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid } } } 'Application Processing' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.ApplicationProcessingEnabled 'Transaction Logs' = Switch ($VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { - 'False' {'Process Transaction Logs'} - 'True' {'Perform Copy Only'} + 'False' { 'Process Transaction Logs' } + 'True' { 'Perform Copy Only' } } 'Use Persistent Guest Agent' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.UsePersistentGuestAgent } if ($InfoLevel.Jobs.Backup -ge 2) { if (!$VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { $TransactionLogsProcessing = Switch ($VSSObj.VssOptions.SqlBackupOptions.TransactionLogsProcessing) { - 'TruncateOnlyOnSuccessJob' {'Truncate logs'} - 'Backup' {'Backup logs periodically'} - 'NeverTruncate' {'Do not truncate logs'} + 'TruncateOnlyOnSuccessJob' { 'Truncate logs' } + 'Backup' { 'Backup logs periodically' } + 'NeverTruncate' { 'Do not truncate logs' } } $RetainLogBackups = Switch ($VSSObj.VssOptions.SqlBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups" } } $inObj.add('SQL Transaction Logs Processing', ($TransactionLogsProcessing)) $inObj.add('SQL Backup Log Every', ("$($VSSObj.VssOptions.SqlBackupOptions.BackupLogsFrequencyMin) min")) @@ -715,18 +690,18 @@ function Get-AbrVbrBackupjobVMware { } if ($VSSObj.VssOptions.OracleBackupOptions.BackupLogsEnabled -or $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { $ArchivedLogsTruncation = Switch ($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { - 'ByAge' {"Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours"} - 'BySize' {"Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB"} - default {$VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation} + 'ByAge' { "Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours" } + 'BySize' { "Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB" } + default { $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation } } $SysdbaCredsId = Switch ($VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId) { - '00000000-0000-0000-0000-000000000000' {'Guest OS Credential'} - default {(Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId}).Description} + '00000000-0000-0000-0000-000000000000' { 'Guest OS Credential' } + default { (Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId }).Description } } $RetainLogBackups = Switch ($VSSObj.VssOptions.OracleBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups" } } $inObj.add('Oracle Account Type', $VSSObj.VssOptions.OracleBackupOptions.AccountType) $inObj.add('Oracle Sysdba Creds', $SysdbaCredsId) @@ -740,24 +715,22 @@ function Get-AbrVbrBackupjobVMware { $inObj.add('File Exclusions', (ConvertTo-TextYN $VSSObj.VssOptions.GuestFSExcludeOptions.FileExcludeEnabled)) if ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'ExcludeSpecifiedFolders') { $inObj.add('Exclude the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.ExcludeList -join ',')) - } - elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { - $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList-join ',')) + } elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { + $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList -join ',')) } } if ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode -ne 'Disabled') { $ScriptingMode = Switch ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode) { - 'FailJobOnError' {'Require successfull script execution'} - 'IgnoreErrors' {'Ignore script execution failures'} - 'Disabled' {'Disable script execution'} + 'FailJobOnError' { 'Require successfull script execution' } + 'IgnoreErrors' { 'Ignore script execution failures' } + 'Disabled' { 'Disable script execution' } } $inObj.add('Scripts', (ConvertTo-TextYN $VSSObj.VssOptions.GuestScriptsOptions.IsAtLeastOneScriptSet)) $inObj.add('Scripts Mode', ($ScriptingMode)) if ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Windows Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PreScriptFilePath)) $inObj.add('Windows Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PostScriptFilePath)) - } - elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { + } elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Linux Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PreScriptFilePath)) $inObj.add('Linux Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PostScriptFilePath)) } @@ -776,9 +749,8 @@ function Get-AbrVbrBackupjobVMware { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -786,20 +758,17 @@ function Get-AbrVbrBackupjobVMware { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." if ($Bkjob.ScheduleOptions.OptionsDaily.Enabled -eq "True") { $ScheduleType = "Daily" $Schedule = "Kind: $($Bkjob.ScheduleOptions.OptionsDaily.Kind),`r`nDays: $($Bkjob.ScheduleOptions.OptionsDaily.DaysSrv)" - } - elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfMonth),`r`nDay Number In Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayNumberInMonth),`r`nDay Of Week: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfWeek)" - } - elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { $ScheduleType = $Bkjob.ScheduleOptions.OptionsPeriodically.Kind $Schedule = "Full Period: $($Bkjob.ScheduleOptions.OptionsPeriodically.FullPeriod),`r`nHourly Offset: $($Bkjob.ScheduleOptions.OptionsPeriodically.HourlyOffset),`r`nUnit: $($Bkjob.ScheduleOptions.OptionsPeriodically.Unit)" - } - elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { $ScheduleType = 'Continuous' $Schedule = "Schedule Time Period" } @@ -807,13 +776,13 @@ function Get-AbrVbrBackupjobVMware { 'Retry Failed item' = $Bkjob.ScheduleOptions.RetryTimes 'Wait before each retry' = "$($Bkjob.ScheduleOptions.RetryTimeout)/min" 'Backup Window' = Switch ($Bkjob.TypeToString) { - "VMware Backup Copy" {ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsContinuous.Enabled} - default {ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled} + "VMware Backup Copy" { ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsContinuous.Enabled } + default { ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled } } 'Shedule type' = $ScheduleType 'Shedule Options' = $Schedule - 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() - 'Latest Run' = $Bkjob.LatestRunLocal + 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() + 'Latest Run' = $Bkjob.LatestRunLocal } $OutObj = [pscustomobject]$inobj @@ -841,10 +810,9 @@ function Get-AbrVbrBackupjobVMware { $Regex = [Regex]::new("(?<=<$Day>)(.*)(?=)") if ($Bkjob.TypeToString -eq "VMware Backup Copy") { $BackupWindow = $Bkjob.ScheduleOptions.OptionsContinuous.Schedule - } else {$BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow} + } else { $BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow } $Match = $Regex.Match($BackupWindow) - if($Match.Success) - { + if ($Match.Success) { $ScheduleTimePeriod += $Match.Value } } @@ -854,7 +822,7 @@ function Get-AbrVbrBackupjobVMware { $TableParams = @{ Name = "Backup Window - $($Bkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -862,45 +830,42 @@ function Get-AbrVbrBackupjobVMware { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style ON -Property "Sat" - - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style OFF -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style ON -Property "Sat" + + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style OFF -Property "Sat" $OutObj2 } } } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } end {} diff --git a/Src/Private/Get-AbrVbrCloudConnectBS.ps1 b/Src/Private/Get-AbrVbrCloudConnectBS.ps1 index 7af9a3f..6f4ad2a 100644 --- a/Src/Private/Get-AbrVbrCloudConnectBS.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectBS.ps1 @@ -5,7 +5,7 @@ function Get-AbrVbrCloudConnectBS { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,12 +20,12 @@ function Get-AbrVbrCloudConnectBS { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Backup Storage information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Backup Storage information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { if (((Get-VBRCloudTenant).Resources.Repository).count -gt 0) { $CloudObjects = (Get-VBRCloudTenant).Resources Section -Style Heading3 'Backup Storage' { @@ -34,31 +34,31 @@ function Get-AbrVbrCloudConnectBS { foreach ($CloudObject in ($CloudObjects.Repository | Sort-Object -Property Name -Unique)) { try { $PercentFree = 0 - if (@($($CloudObject.GetContainer().CachedTotalSpace.InGigabytes),$($CloudObject.GetContainer().CachedFreeSpace.InGigabytes)) -ne 0) { - $UsedSpace = ($($CloudObject.GetContainer().CachedTotalSpace.InGigabytes-$($CloudObject.GetContainer().CachedFreeSpace.InGigabytes))) + if (@($($CloudObject.GetContainer().CachedTotalSpace.InGigabytes), $($CloudObject.GetContainer().CachedFreeSpace.InGigabytes)) -ne 0) { + $UsedSpace = ($($CloudObject.GetContainer().CachedTotalSpace.InGigabytes - $($CloudObject.GetContainer().CachedFreeSpace.InGigabytes))) if ($UsedSpace -ne 0) { - $PercentFree = $([Math]::Round($UsedSpace/$($CloudObject.GetContainer().CachedTotalSpace.InGigabytes) * 100)) + $PercentFree = $([Math]::Round($UsedSpace / $($CloudObject.GetContainer().CachedTotalSpace.InGigabytes) * 100)) } } Section -Style Heading4 $CloudObject.Name { $OutObj = @() try { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Backup Storage information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Backup Storage information." $inObj = [ordered] @{ 'Type' = $CloudObject.TypeDisplay 'Path' = Switch ([string]::IsNullOrEmpty($CloudObject.FriendlyPath)) { - $true {'--'} - $false {$CloudObject.FriendlyPath} - default {'Unknown'} + $true { '--' } + $false { $CloudObject.FriendlyPath } + default { 'Unknown' } } 'Total Space' = "$($CloudObject.GetContainer().CachedTotalSpace.InGigabytes) GB" 'Free Space' = "$($CloudObject.GetContainer().CachedFreeSpace.InGigabytes) GB" 'Used Space %' = $PercentFree 'Status' = Switch ($CloudObject.IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {$CloudObject.IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { $CloudObject.IsUnavailable } } 'Description' = $CloudObject.Description } @@ -80,22 +80,22 @@ function Get-AbrVbrCloudConnectBS { Section -ExcludeFromTOC -Style NOTOCHeading5 'Tenant Utilization' { $OutObj = @() try { - foreach ($Tenant in ($CloutTenant | Where-Object {$_.Resources.Repository.Name -eq $CloudObject.Name})) { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Tenant utilization." - foreach ($Storage in ($Tenant.Resources | Where-Object {$_.Repository.Name -eq $CloudObject.Name})) { + foreach ($Tenant in ($CloutTenant | Where-Object { $_.Resources.Repository.Name -eq $CloudObject.Name })) { + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Tenant utilization." + foreach ($Storage in ($Tenant.Resources | Where-Object { $_.Repository.Name -eq $CloudObject.Name })) { $inObj = [ordered] @{ 'Name' = $Tenant.Name 'Quota' = "$([math]::Round($Storage.RepositoryQuota / 1Kb, 2)) GB" 'Used Space' = Switch ([string]::IsNullOrEmpty($Storage.UsedSpace)) { - $true {'--'} - $false {"$(Convert-Size -From MB -To GB -Value $Storage.UsedSpace) GB"} - default {'Unknown'} + $true { '--' } + $false { "$(Convert-Size -From MB -To GB -Value $Storage.UsedSpace) GB" } + default { 'Unknown' } } 'Used Space %' = $Storage.UsedSpacePercentage 'Path' = Switch ([string]::IsNullOrEmpty($Storage.RepositoryQuotaPath)) { - $true {'--'} - $false {$Storage.RepositoryQuotaPath} - default {'Unknown'} + $true { '--' } + $false { $Storage.RepositoryQuotaPath } + default { 'Unknown' } } } @@ -104,7 +104,7 @@ function Get-AbrVbrCloudConnectBS { } if ($HealthCheck.CloudConnect.BackupStorage) { - $OutObj | Where-Object { $_.'Used Space %' -gt 85} | Set-Style -Style Warning -Property 'Used Space %' + $OutObj | Where-Object { $_.'Used Space %' -gt 85 } | Set-Style -Style Warning -Property 'Used Space %' } $TableParams = @{ @@ -117,31 +117,26 @@ function Get-AbrVbrCloudConnectBS { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Tenant Utilization - $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Tenant Utilization - $($CloudObject.Name) Section: $($_.Exception.Message)" } } + } catch { + Write-PScriboMessage -IsWarning "Tenant Utilization Section: $($_.Exception.Message)" } - catch { - Write-PscriboMessage -IsWarning "Tenant Utilization Section: $($_.Exception.Message)" - } - } - catch { - Write-PscriboMessage -IsWarning "Tenant Utilization Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Tenant Utilization Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "$($CloudObject.Name) Cloud Backup Storage Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "$($CloudObject.Name) Cloud Backup Storage Section: $($_.Exception.Message)" } } } } } - } - catch { - Write-PscriboMessage -IsWarning "Cloud Backup Storage Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Backup Storage Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrCloudConnectCG.ps1 b/Src/Private/Get-AbrVbrCloudConnectCG.ps1 index 1d22463..536f601 100644 --- a/Src/Private/Get-AbrVbrCloudConnectCG.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectCG.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectCG { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrCloudConnectCG { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Gateway information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Gateway information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { $CloudObjects = Get-VBRCloudGateway | Sort-Object -Property Name if ($CloudObjects) { Section -Style Heading3 'Cloud Gateways' { @@ -36,7 +36,7 @@ function Get-AbrVbrCloudConnectCG { $OutObj = @() foreach ($CloudObject in $CloudObjects) { try { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Gateway information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Gateway information." $inObj = [ordered] @{ 'Name' = $CloudObject.Name @@ -49,10 +49,10 @@ function Get-AbrVbrCloudConnectCG { if ($InfoLevel.CloudConnect.CloudGateway -ge 2) { $CloudGPObjects = Get-VBRCloudGatewayPool - $CGPool = Switch ([string]::IsNullOrEmpty(($CloudGPObjects | where-Object {$CloudObject.Name -in $_.CloudGateways.Name}).Name)) { - $true {'--'} - $false {($CloudGPObjects | where-Object {$CloudObject.Name -in $_.CloudGateways.Name}).Name} - default {'--'} + $CGPool = Switch ([string]::IsNullOrEmpty(($CloudGPObjects | Where-Object { $CloudObject.Name -in $_.CloudGateways.Name }).Name)) { + $true { '--' } + $false { ($CloudGPObjects | Where-Object { $CloudObject.Name -in $_.CloudGateways.Name }).Name } + default { '--' } } $inObj.add('Cloud Gateway Pool', $CGPool) $inObj.add('Description', $CloudObject.Description) @@ -82,7 +82,7 @@ function Get-AbrVbrCloudConnectCG { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -93,9 +93,8 @@ function Get-AbrVbrCloudConnectCG { } } - } - catch { - Write-PscriboMessage -IsWarning "Cloud Gateways $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Gateways $($CloudObject.Name) Section: $($_.Exception.Message)" } } @@ -112,16 +111,14 @@ function Get-AbrVbrCloudConnectCG { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Cloud Gateways Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Gateways Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Cloud Gateways Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Gateways Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrCloudConnectCert.ps1 b/Src/Private/Get-AbrVbrCloudConnectCert.ps1 index 574c77e..ff49b0e 100644 --- a/Src/Private/Get-AbrVbrCloudConnectCert.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectCert.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectCert { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrCloudConnectCert { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud SSL Certificate information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud SSL Certificate information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { $CloudObjects = Get-VBRCloudGatewayCertificate if ($CloudObjects) { Section -Style Heading3 'Gateway Certificate' { @@ -36,7 +36,7 @@ function Get-AbrVbrCloudConnectCert { $OutObj = @() foreach ($CloudObject in $CloudObjects) { try { - Write-PscriboMessage "Discovered $($CloudObject.DisplayName) Cloud Gateway SSL Certificate information." + Write-PScriboMessage "Discovered $($CloudObject.DisplayName) Cloud Gateway SSL Certificate information." $inObj = [ordered] @{ 'Name' = $CloudObject.DisplayName @@ -50,9 +50,8 @@ function Get-AbrVbrCloudConnectCert { $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($CloudObject.DisplayName) Gateway SSL Certificate Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "$($CloudObject.DisplayName) Gateway SSL Certificate Section: $($_.Exception.Message)" } } @@ -66,16 +65,14 @@ function Get-AbrVbrCloudConnectCert { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Gateway SSL Certificate Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Gateway SSL Certificate Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Gateway Certificate Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Gateway Certificate Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrCloudConnectGP.ps1 b/Src/Private/Get-AbrVbrCloudConnectGP.ps1 index 6253c0e..4e77bb5 100644 --- a/Src/Private/Get-AbrVbrCloudConnectGP.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectGP.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectGP { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrCloudConnectGP { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Gateway Pools information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Gateway Pools information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { $CloudObjects = Get-VBRCloudGatewayPool | Sort-Object -Property Name if ($CloudObjects) { Section -Style Heading3 'Gateways Pools' { @@ -36,7 +36,7 @@ function Get-AbrVbrCloudConnectGP { $OutObj = @() foreach ($CloudObject in $CloudObjects) { try { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Gateway Pools information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Gateway Pools information." $inObj = [ordered] @{ 'Name' = $CloudObject.Name @@ -45,9 +45,8 @@ function Get-AbrVbrCloudConnectGP { } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Gateways Pools $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Gateways Pools $($CloudObject.Name) Section: $($_.Exception.Message)" } } @@ -67,7 +66,7 @@ function Get-AbrVbrCloudConnectGP { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -77,16 +76,14 @@ function Get-AbrVbrCloudConnectGP { } } - } - catch { - Write-PscriboMessage -IsWarning "Gateways Pools Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Gateways Pools Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } end {} diff --git a/Src/Private/Get-AbrVbrCloudConnectPublicIP.ps1 b/Src/Private/Get-AbrVbrCloudConnectPublicIP.ps1 index 4eb2720..4d68bfc 100644 --- a/Src/Private/Get-AbrVbrCloudConnectPublicIP.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectPublicIP.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectPublicIP { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,11 +21,11 @@ function Get-AbrVbrCloudConnectPublicIP { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Public IP information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Public IP information from $System." } process { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { if ((Get-VBRCloudGatewayPool).count -gt 0) { Section -Style Heading3 'Public IP' { Paragraph "The following section provides information about Cloud Public IP." @@ -38,17 +38,16 @@ function Get-AbrVbrCloudConnectPublicIP { $inObj = [ordered] @{ 'IP Address' = $CloudObject.IpAddress 'Assigned Tenant' = Switch ([string]::IsNullOrEmpty($CloudObject.TenantId)) { - $true {'--'} - $false {(Get-VBRCloudTenant -Id $CloudObject.TenantId).Name} - default {'Unknown'} + $true { '--' } + $false { (Get-VBRCloudTenant -Id $CloudObject.TenantId).Name } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Cloud Public IP $($CloudObject.IpAddress) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Public IP $($CloudObject.IpAddress) Section: $($_.Exception.Message)" } } @@ -62,9 +61,8 @@ function Get-AbrVbrCloudConnectPublicIP { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Cloud Public IP Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Public IP Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrCloudConnectRR.ps1 b/Src/Private/Get-AbrVbrCloudConnectRR.ps1 index bdaeffe..e0bcf84 100644 --- a/Src/Private/Get-AbrVbrCloudConnectRR.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectRR.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectRR { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,11 +21,11 @@ function Get-AbrVbrCloudConnectRR { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Connect Replica Resources information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Connect Replica Resources information from $System." } process { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { $CloudObjects = Get-VBRCloudHardwarePlan if ($CloudObjects) { Section -Style Heading3 'Replica Resources' { @@ -35,19 +35,19 @@ function Get-AbrVbrCloudConnectRR { $OutObj = @() foreach ($CloudObject in $CloudObjects) { try { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Connect Replica Resources information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Connect Replica Resources information." $inObj = [ordered] @{ 'Name' = $CloudObject.Name 'Platform' = $CloudObject.Platform 'CPU' = Switch ([string]::IsNullOrEmpty($CloudObject.CPU)) { - $true {'Unlimited'} - $false {"$([math]::Round($CloudObject.CPU / 1000, 1)) Ghz"} - default {'--'} + $true { 'Unlimited' } + $false { "$([math]::Round($CloudObject.CPU / 1000, 1)) Ghz" } + default { '--' } } 'Memory' = Switch ([string]::IsNullOrEmpty($CloudObject.Memory)) { - $true {'Unlimited'} - $false {"$([math]::Round($CloudObject.Memory / 1Kb, 2)) GB"} - default {'--'} + $true { 'Unlimited' } + $false { "$([math]::Round($CloudObject.Memory / 1Kb, 2)) GB" } + default { '--' } } 'Storage Quota' = "$(($CloudObject.Datastore.Quota | Measure-Object -Sum).Sum) GB" 'Network Count' = $CloudObject.NumberOfNetWithInternet + $CloudObject.NumberOfNetWithoutInternet @@ -55,14 +55,13 @@ function Get-AbrVbrCloudConnectRR { } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Replica Resources $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica Resources $($CloudObject.Name) Section: $($_.Exception.Message)" } } if ($HealthCheck.CloudConnect.ReplicaResources) { - $OutObj | Where-Object { $_.'Subscribers Count' -eq 0} | Set-Style -Style Warning -Property 'Subscribers Count' + $OutObj | Where-Object { $_.'Subscribers Count' -eq 0 } | Set-Style -Style Warning -Property 'Subscribers Count' } $TableParams = @{ @@ -87,25 +86,25 @@ function Get-AbrVbrCloudConnectRR { Section -Style Heading5 $CloudObject.Name { try { Section -ExcludeFromTOC -Style NOTOCHeading6 'Host Hardware Quota' { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Connect Hardware Quota information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Connect Hardware Quota information." $inObj = [ordered] @{ 'Host or Cluster' = "$($CloudObject.Host.Name) ($($CloudObject.Host.Type))" 'Platform' = $CloudObject.Platform 'CPU' = Switch ([string]::IsNullOrEmpty($CloudObject.CPU)) { - $true {'Unlimited'} - $false {"$([math]::Round($CloudObject.CPU / 1000, 1)) Ghz"} - default {'--'} + $true { 'Unlimited' } + $false { "$([math]::Round($CloudObject.CPU / 1000, 1)) Ghz" } + default { '--' } } 'Memory' = Switch ([string]::IsNullOrEmpty($CloudObject.Memory)) { - $true {'Unlimited'} - $false {"$([math]::Round($CloudObject.Memory / 1Kb, 2)) GB"} - default {'--'} + $true { 'Unlimited' } + $false { "$([math]::Round($CloudObject.Memory / 1Kb, 2)) GB" } + default { '--' } } 'Network Count' = $CloudObject.NumberOfNetWithInternet + $CloudObject.NumberOfNetWithoutInternet 'Subscribed Tenant' = Switch ([string]::IsNullOrEmpty($CloudObject.SubscribedTenantId)) { - $true {'None'} - $false {($CloudObject.SubscribedTenantId | ForEach-Object {Get-VBRCloudTenant -Id $_}).Name -join ", "} - default {'Unknown'} + $true { 'None' } + $false { ($CloudObject.SubscribedTenantId | ForEach-Object { Get-VBRCloudTenant -Id $_ }).Name -join ", " } + default { 'Unknown' } } 'Description' = $CloudObject.Description } @@ -113,7 +112,7 @@ function Get-AbrVbrCloudConnectRR { $OutObj += [pscustomobject]$inobj if ($HealthCheck.CloudConnect.ReplicaResources) { - $OutObj | Where-Object {$_.'Subscribed Tenant' -eq 'None'} | Set-Style -Style Warning -Property 'Subscribed Tenant' + $OutObj | Where-Object { $_.'Subscribed Tenant' -eq 'None' } | Set-Style -Style Warning -Property 'Subscribed Tenant' } $TableParams = @{ @@ -127,14 +126,13 @@ function Get-AbrVbrCloudConnectRR { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Host Hardware Quota $($CloudObject.Host.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Host Hardware Quota $($CloudObject.Host.Name) Section: $($_.Exception.Message)" } try { Section -ExcludeFromTOC -Style NOTOCHeading6 'Storage Quota' { $OutObj = @() - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Connect Storage Quota information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Connect Storage Quota information." foreach ($Storage in $CloudObject.Datastore) { $inObj = [ordered] @{ 'Datastore Name' = $Storage.Datastore @@ -142,9 +140,9 @@ function Get-AbrVbrCloudConnectRR { 'Platform' = $Storage.Platform 'Storage Quota' = "$($Storage.Quota) GB" 'Storage Policy' = Switch ([string]::IsNullOrEmpty($Storage.StoragePolicy.Name)) { - $true {'--'} - $false {$Storage.StoragePolicy.Name} - default {'Unknown'} + $true { '--' } + $false { $Storage.StoragePolicy.Name } + default { 'Unknown' } } } @@ -162,15 +160,14 @@ function Get-AbrVbrCloudConnectRR { $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Storage Quota $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Storage Quota $($CloudObject.Name) Section: $($_.Exception.Message)" } try { Section -ExcludeFromTOC -Style NOTOCHeading6 'Network Quota' { $OutObj = @() - $VlanConfiguration = Get-VBRCloudVLANConfiguration | Where-Object {$_.Host.Name -eq $CloudObject.Host.Name} - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Connect Network Quota information." + $VlanConfiguration = Get-VBRCloudVLANConfiguration | Where-Object { $_.Host.Name -eq $CloudObject.Host.Name } + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Connect Network Quota information." $inObj = [ordered] @{ 'Specify number of networks with Internet Access' = $CloudObject.NumberOfNetWithInternet + $CloudObject.NumberOfNetWithoutInternet 'Specify number of internal networks' = $CloudObject.NumberOfNetWithoutInternet @@ -197,16 +194,15 @@ function Get-AbrVbrCloudConnectRR { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Network Quota $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Network Quota $($CloudObject.Name) Section: $($_.Exception.Message)" } try { - $Tenants = Get-VBRCloudTenant | where-Object {$_.ReplicationResources.HardwarePlanOptions.HardwarePlanId -eq $CloudObject.Id} + $Tenants = Get-VBRCloudTenant | Where-Object { $_.ReplicationResources.HardwarePlanOptions.HardwarePlanId -eq $CloudObject.Id } $TenantHardwarePlan = @() foreach ($Tenant in $Tenants) { - $planOption = $Tenant.ReplicationResources.HardwarePlanOptions | Where-Object {$_.HardwarePlanId -eq $CloudObject.Id} - $TenantHardwarePlan += $Tenant | Select-Object Name, @{n='CPUUsage';e={$planOption.UsedCPU}}, @{n='MemoryUsage';e={$planOption.UsedMemory}}, @{n='StorageUsage';e={$planOption.DatastoreQuota}} + $planOption = $Tenant.ReplicationResources.HardwarePlanOptions | Where-Object { $_.HardwarePlanId -eq $CloudObject.Id } + $TenantHardwarePlan += $Tenant | Select-Object Name, @{n = 'CPUUsage'; e = { $planOption.UsedCPU } }, @{n = 'MemoryUsage'; e = { $planOption.UsedMemory } }, @{n = 'StorageUsage'; e = { $planOption.DatastoreQuota } } } if ($TenantHardwarePlan) { Section -ExcludeFromTOC -Style NOTOCHeading6 'Tenant Utilization' { @@ -216,7 +212,7 @@ function Get-AbrVbrCloudConnectRR { 'Name' = $TenantUtil.Name 'CPU Usage' = $TenantUtil.CPUUsage 'Memory Usage' = $TenantUtil.MemoryUsage - 'Storage Usage' = $TenantUtil.StorageUsage | ForEach-Object {"$($_.UsedSpace) GB ($($_.FriendlyName))"} + 'Storage Usage' = $TenantUtil.StorageUsage | ForEach-Object { "$($_.UsedSpace) GB ($($_.FriendlyName))" } } $OutObj += [pscustomobject]$inobj @@ -234,25 +230,21 @@ function Get-AbrVbrCloudConnectRR { $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Tenant Utilization $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Tenant Utilization $($CloudObject.Name) Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Replica Resources Configuration $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica Resources Configuration $($CloudObject.Name) Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Replica Resources Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica Resources Configuration Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Replica Resources Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica Resources Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrCloudConnectStatus.ps1 b/Src/Private/Get-AbrVbrCloudConnectStatus.ps1 index 58a105d..a9fc40b 100644 --- a/Src/Private/Get-AbrVbrCloudConnectStatus.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectStatus.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectStatus { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,11 +21,11 @@ function Get-AbrVbrCloudConnectStatus { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Connect Service Status information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Connect Service Status information from $System." } process { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { $CloudConnectInfraStatus = Get-VBRCloudInfrastructureState if ($CloudConnectInfraStatus) { Section -Style Heading3 'Service Status' { @@ -35,7 +35,7 @@ function Get-AbrVbrCloudConnectStatus { $CloudConnectInfraServiceStatus = Get-VBRCloudInfrastructureServiceState $OutObj = @() try { - Write-PscriboMessage "Discovered $($CloudObject.DisplayName) Cloud Connect Service Status information." + Write-PScriboMessage "Discovered $($CloudObject.DisplayName) Cloud Connect Service Status information." $inObj = [ordered] @{ 'Server Name' = $VeeamBackupServer 'Global Status' = $CloudConnectInfraStatus @@ -45,13 +45,12 @@ function Get-AbrVbrCloudConnectStatus { $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Cloud Connect Service Status $($CloudObject.DisplayName) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Connect Service Status $($CloudObject.DisplayName) Section: $($_.Exception.Message)" } if ($HealthCheck.Infrastructure.BackupServer) { - $OutObj | Where-Object { $_.'Global Status' -eq 'Maintenance'} | Set-Style -Style Warning -Property 'Global Status' + $OutObj | Where-Object { $_.'Global Status' -eq 'Maintenance' } | Set-Style -Style Warning -Property 'Global Status' } $TableParams = @{ @@ -64,9 +63,8 @@ function Get-AbrVbrCloudConnectStatus { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Cloud Connect Service Status Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Connect Service Status Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrCloudConnectSummary.ps1 b/Src/Private/Get-AbrVbrCloudConnectSummary.ps1 index eac878b..4c14349 100644 --- a/Src/Private/Get-AbrVbrCloudConnectSummary.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectSummary.ps1 @@ -5,7 +5,7 @@ function Get-AbrVbrCloudConnectSummary { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrVbrCloudConnectSummary { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Connect Summary from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Connect Summary from $System." } process { @@ -43,9 +43,8 @@ function Get-AbrVbrCloudConnectSummary { 'Hardware Plans' = $CloudConnectRR.Count } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Cloud Connect Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Connect Summary Section: $($_.Exception.Message)" } $TableParams = @{ @@ -58,11 +57,11 @@ function Get-AbrVbrCloudConnectSummary { } if ($Options.EnableCharts) { try { - $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'CloudConnectInventory' -XField 'Category' -YField 'Value' -ChartLegendName 'Infrastructure' } catch { - Write-PscriboMessage -IsWarning "Cloud Connect Inventory chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Cloud Connect Inventory chart section: $($_.Exception.Message)" } } @@ -75,9 +74,8 @@ function Get-AbrVbrCloudConnectSummary { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Cloud Connect Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Cloud Connect Summary Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrCloudConnectTenant.ps1 b/Src/Private/Get-AbrVbrCloudConnectTenant.ps1 index f2ad546..d97db5a 100644 --- a/Src/Private/Get-AbrVbrCloudConnectTenant.ps1 +++ b/Src/Private/Get-AbrVbrCloudConnectTenant.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCloudConnectTenant { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrCloudConnectTenant { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Cloud Tenants information from $System." + Write-PScriboMessage "Discovering Veeam VBR Cloud Tenants information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled"}) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" }) { $CloudObjects = Get-VBRCloudTenant | Sort-Object -Property Name if ($CloudObjects) { Section -Style Heading3 'Tenants' { @@ -35,28 +35,27 @@ function Get-AbrVbrCloudConnectTenant { $OutObj = @() foreach ($CloudObject in $CloudObjects) { try { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Tenants information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Tenants information." $inObj = [ordered] @{ 'Name' = $CloudObject.Name 'Type' = Switch ($CloudObject.Type) { - 'Ad' {'Active Directory'} - 'General' {'Standalone'} - 'vCD' {'vCloud Director'} - default {'Unknown'} + 'Ad' { 'Active Directory' } + 'General' { 'Standalone' } + 'vCD' { 'vCloud Director' } + default { 'Unknown' } } 'Last Active' = $CloudObject.LastActive 'Last Result' = $CloudObject.LastResult } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Tenants $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Tenants $($CloudObject.Name) Section: $($_.Exception.Message)" } } if ($HealthCheck.CloudConnect.Tenants) { - $OutObj | Where-Object { $_.'Last Result' -ne 'Success'} | Set-Style -Style Warning -Property 'Last Result' + $OutObj | Where-Object { $_.'Last Result' -ne 'Success' } | Set-Style -Style Warning -Property 'Last Result' $OutObj | Where-Object { $Null -like $_.'Last Active' } | Set-Style -Style Warning -Property 'Last Active' } @@ -93,37 +92,37 @@ function Get-AbrVbrCloudConnectTenant { $OutObj = @() try { Section -ExcludeFromTOC -Style NOTOCHeading6 'General Information' { - Write-PscriboMessage "Discovered $($CloudObject.Name) Cloud Tenants information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Cloud Tenants information." $inObj = [ordered] @{ 'Name' = $CloudObject.Name 'Type' = Switch ($CloudObject.Type) { - 'Ad' {'Active Directory'} - 'General' {'Standalone'} - 'vCD' {'vCloud Director'} - default {'Unknown'} + 'Ad' { 'Active Directory' } + 'General' { 'Standalone' } + 'vCD' { 'vCloud Director' } + default { 'Unknown' } } 'Status' = Switch ($CloudObject.Enabled) { - 'True' {'Enabled'} - 'False' {'Disabled'} - default {'Unknown'} + 'True' { 'Enabled' } + 'False' { 'Disabled' } + default { 'Unknown' } } 'Expiration Date' = Switch ([string]::IsNullOrEmpty($CloudObject.LeaseExpirationDate)) { - $true {'Never'} - $false {$CloudObject.LeaseExpirationDate.ToLongDateString()} - default {'--'} + $true { 'Never' } + $false { $CloudObject.LeaseExpirationDate.ToLongDateString() } + default { '--' } } 'Backup Storage (Cloud Backup Repository)' = ConvertTo-TextYN $CloudObject.ResourcesEnabled 'Replication Resource (Cloud Host)' = Switch ($CloudObject.ReplicationResourcesEnabled -or $CloudObject.vCDReplicationResourcesEnabled) { - 'True' {'Yes'} - 'False' {'No'} - default {'--'} + 'True' { 'Yes' } + 'False' { 'No' } + default { '--' } } 'Description' = $CloudObject.Description } if ($CloudObject.Type -eq 'Ad') { - $inObj.add('Domain',$CloudObject.DomainUrl) - $inObj.add('Domain Username',$CloudObject.Name) + $inObj.add('Domain', $CloudObject.DomainUrl) + $inObj.add('Domain Username', $CloudObject.Name) } $OutObj = [pscustomobject]$inobj @@ -144,7 +143,7 @@ function Get-AbrVbrCloudConnectTenant { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -158,7 +157,7 @@ function Get-AbrVbrCloudConnectTenant { Section -ExcludeFromTOC -Style NOTOCHeading6 'Bandwidth' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($CloudObject.Name) Bandwidth information." + Write-PScriboMessage "Discovered $($CloudObject.Name) Bandwidth information." $inObj = [ordered] @{ 'Max Concurrent Task' = $CloudObject.MaxConcurrentTask } @@ -166,9 +165,9 @@ function Get-AbrVbrCloudConnectTenant { if ($CloudObject.ThrottlingEnabled) { $inObj.add('Limit network traffic from this tenant?', (ConvertTo-TextYN $CloudObject.ThrottlingEnabled)) Switch ($CloudObject.ThrottlingUnit) { - 'MbytePerSec' {$inObj.add('Throttling network traffic to',"$($CloudObject.ThrottlingValue) MB/s")} - 'KbytePerSec' {$inObj.add('Throttling network traffic to',"$($CloudObject.ThrottlingValue) KB/s")} - 'MbitPerSec' {$inObj.add('Throttling network traffic to',"$($CloudObject.ThrottlingValue) Mbps")} + 'MbytePerSec' { $inObj.add('Throttling network traffic to', "$($CloudObject.ThrottlingValue) MB/s") } + 'KbytePerSec' { $inObj.add('Throttling network traffic to', "$($CloudObject.ThrottlingValue) KB/s") } + 'MbitPerSec' { $inObj.add('Throttling network traffic to', "$($CloudObject.ThrottlingValue) Mbps") } } } @@ -176,9 +175,9 @@ function Get-AbrVbrCloudConnectTenant { $inObj.add('Gateway Pool', 'Automatic') } else { $GatewayPool = Switch ([string]::IsNullOrEmpty($CloudObject.GatewayPool.Name)) { - $true {'--'} - $false {$CloudObject.GatewayPool.Name} - default {'Unknown'} + $true { '--' } + $false { $CloudObject.GatewayPool.Name } + default { 'Unknown' } } $inObj.add('Gateway Type', 'Gateway Pool') $inObj.add('Gateway Pool', $GatewayPool) @@ -197,14 +196,12 @@ function Get-AbrVbrCloudConnectTenant { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Bandwidth $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Bandwidth $($CloudObject.Name) Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Bandwidth $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Bandwidth $($CloudObject.Name) Section: $($_.Exception.Message)" } if ($CloudObject.ResourcesEnabled -and $CloudObject.Resources) { try { @@ -212,11 +209,11 @@ function Get-AbrVbrCloudConnectTenant { $OutObj = @() foreach ($CloudBackupRepo in $CloudObject.Resources) { try { - Write-PscriboMessage "Discovered $($CloudBackupRepo.RepositoryFriendlyName) Backup Resources information." + Write-PScriboMessage "Discovered $($CloudBackupRepo.RepositoryFriendlyName) Backup Resources information." $inObj = [ordered] @{ 'Repository' = $CloudBackupRepo.Repository.Name 'Friendly Name' = $CloudBackupRepo.RepositoryFriendlyName - 'Quota' = "$(Convert-Size -from MB -to GB -Value $CloudBackupRepo.RepositoryQuota) GB" + 'Quota' = "$(Convert-Size -From MB -To GB -Value $CloudBackupRepo.RepositoryQuota) GB" 'Quota Path' = $CloudBackupRepo.RepositoryQuotaPath 'Use Wan Acceleration' = ConvertTo-TextYN $CloudBackupRepo.WanAccelerationEnabled } @@ -240,15 +237,13 @@ function Get-AbrVbrCloudConnectTenant { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Backup Resources $($CloudBackupRepo.RepositoryFriendlyName) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Resources $($CloudBackupRepo.RepositoryFriendlyName) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Backup Resources Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Resources Section: $($_.Exception.Message)" } } if ($CloudObject.ReplicationResourcesEnabled -and $CloudObject.ReplicationResources.HardwarePlanOptions) { @@ -257,9 +252,9 @@ function Get-AbrVbrCloudConnectTenant { $OutObj = @() foreach ($CloudRepliRes in $CloudObject.ReplicationResources) { try { - Write-PscriboMessage "Discovered $($CloudRepliRes.RepositoryFriendlyName) Replication Resources information." + Write-PScriboMessage "Discovered $($CloudRepliRes.RepositoryFriendlyName) Replication Resources information." $inObj = [ordered] @{ - 'Hardware Plans' = (Get-VBRCloudHardwarePlan | Where-Object {$_.SubscribedTenantId -contains $CloudObject.Id}).Name -join ', ' + 'Hardware Plans' = (Get-VBRCloudHardwarePlan | Where-Object { $_.SubscribedTenantId -contains $CloudObject.Id }).Name -join ', ' 'Use Veeam Network Extension Capabilities during Partial and Full Site Failover' = ConvertTo-TextYN $CloudRepliRes.NetworkFailoverResourcesEnabled } @@ -275,15 +270,13 @@ function Get-AbrVbrCloudConnectTenant { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Replication Resources $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Resources $($CloudObject.Name) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Replication Resources Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Resources Section: $($_.Exception.Message)" } } if ($CloudObject.vCDReplicationResourcesEnabled) { @@ -292,7 +285,7 @@ function Get-AbrVbrCloudConnectTenant { $OutObj = @() foreach ($CloudRepliRes in $CloudObject.vCDReplicationResource.OrganizationvDCOptions) { try { - Write-PscriboMessage "Discovered $($CloudRepliRes.RepositoryFriendlyName) Replication Resources information." + Write-PScriboMessage "Discovered $($CloudRepliRes.RepositoryFriendlyName) Replication Resources information." $inObj = [ordered] @{ 'Organization vDC Name' = $CloudRepliRes.OrganizationvDCName 'Allocation Model' = $CloudRepliRes.AllocationModel @@ -315,15 +308,13 @@ function Get-AbrVbrCloudConnectTenant { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Replication Resources (vCD) $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Resources (vCD) $($CloudObject.Name) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Replication Resources (vCD) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Resources (vCD) Section: $($_.Exception.Message)" } } if ($CloudObject.ReplicationResources.NetworkFailoverResourcesEnabled -or $CloudObject.vCDReplicationResource.TenantNetworkAppliance) { @@ -334,7 +325,7 @@ function Get-AbrVbrCloudConnectTenant { $OutObj = @() foreach ($TenantNetworkAppliance in $TenantNetworkAppliances) { try { - Write-PscriboMessage "Discovered $($TenantNetworkAppliance.Name) Network Extension information." + Write-PScriboMessage "Discovered $($TenantNetworkAppliance.Name) Network Extension information." $inObj = [ordered] @{ 'Name' = $TenantNetworkAppliance.Name 'Platform' = $TenantNetworkAppliance.Platform @@ -365,46 +356,44 @@ function Get-AbrVbrCloudConnectTenant { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Network Extension $($CloudObject.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Network Extension $($CloudObject.Name) Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Network Extension Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Network Extension Section: $($_.Exception.Message)" } } try { - $CloudSubTenants = Get-VBRCloudSubTenant | Where-Object {$_.TenantId -eq $CloudObject.Id} + $CloudSubTenants = Get-VBRCloudSubTenant | Where-Object { $_.TenantId -eq $CloudObject.Id } if ($CloudSubTenants) { Section -ExcludeFromTOC -Style NOTOCHeading6 'Sub-Tenants' { $OutObj = @() foreach ($CloudSubTenant in $CloudSubTenants) { try { - Write-PscriboMessage "Discovered $($CloudSubTenant.Name) Subtenant information." + Write-PScriboMessage "Discovered $($CloudSubTenant.Name) Subtenant information." $inObj = [ordered] @{ 'Name' = $CloudSubTenant.Name 'Type' = $CloudSubTenant.Type 'Mode' = $CloudSubTenant.Mode 'Repository Name' = $CloudSubTenant.Resources.RepositoryFriendlyName - 'Quota' = "$(Convert-Size -from MB -to GB -Value $CloudSubTenant.Resources.RepositoryQuota) GB" + 'Quota' = "$(Convert-Size -From MB -To GB -Value $CloudSubTenant.Resources.RepositoryQuota) GB" 'Quota Path' = $CloudSubTenant.Resources.RepositoryQuotaPath 'Used Space %' = $CloudSubTenant.Resources.UsedSpacePercentage 'Status' = Switch ($CloudSubTenant.Enabled) { - 'True' {'Enabled'} - 'False' {'Disabled'} - default {'--'} + 'True' { 'Enabled' } + 'False' { 'Disabled' } + default { '--' } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.CloudConnect.Tenants) { - $OutObj | Where-Object { $_.'Used Space %' -gt 85} | Set-Style -Style Warning -Property 'Used Space %' - $OutObj | Where-Object { $_.'Status' -eq 'Disabled'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Used Space %' -gt 85 } | Set-Style -Style Warning -Property 'Used Space %' + $OutObj | Where-Object { $_.'Status' -eq 'Disabled' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -417,21 +406,19 @@ function Get-AbrVbrCloudConnectTenant { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Subtenant $($CloudSubTenant.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Subtenant $($CloudSubTenant.Name) Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Subtenant Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Subtenant Section: $($_.Exception.Message)" } try { Section -ExcludeFromTOC -Style NOTOCHeading6 'Licenses Utilization' { $OutObj = @() - Write-PscriboMessage "Discovered $($CloudObject.Name) License Utilization information." + Write-PScriboMessage "Discovered $($CloudObject.Name) License Utilization information." $inObj = [ordered] @{ 'New VM Backup' = $CloudObject.NewVMBackupCount 'New Workstation Backup' = $CloudObject.NewWorkstationBackupCount @@ -456,28 +443,24 @@ function Get-AbrVbrCloudConnectTenant { } $OutObj | Table @TableParams } + } catch { + Write-PScriboMessage -IsWarning "Licenses Utilization $($CloudObject.Name) Section: $($_.Exception.Message)" } - catch { - Write-PscriboMessage -IsWarning "Licenses Utilization $($CloudObject.Name) Section: $($_.Exception.Message)" - } - } - catch { - Write-PscriboMessage -IsWarning "Licenses Utilization Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Licenses Utilization Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Tenants Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Tenants Configuration Section: $($_.Exception.Message)" } } } } } - } - catch { - Write-PscriboMessage -IsWarning "Tenants Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Tenants Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrConfigurationBackupSetting.ps1 b/Src/Private/Get-AbrVbrConfigurationBackupSetting.ps1 index 3ed3e97..2e4dee9 100644 --- a/Src/Private/Get-AbrVbrConfigurationBackupSetting.ps1 +++ b/Src/Private/Get-AbrVbrConfigurationBackupSetting.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrConfigurationBackupSetting { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrConfigurationBackupSetting { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Configuration Backup settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR Configuration Backup settings information from $System." } process { @@ -33,8 +33,7 @@ function Get-AbrVbrConfigurationBackupSetting { try { if ($BackupSettings.ScheduleOptions.Type -like "Daily") { $ScheduleOptions = "Type: $($BackupSettings.ScheduleOptions.DailyOptions.Type)`r`nPeriod: $($BackupSettings.ScheduleOptions.DailyOptions.Period)`r`nDay Of Week: $($BackupSettings.ScheduleOptions.DailyOptions.DayOfWeek)" - } - elseif ($BackupSettings.ScheduleOptions.Type -like "Monthly") { + } elseif ($BackupSettings.ScheduleOptions.Type -like "Monthly") { $ScheduleOptions = "Period: $($BackupSettings.ScheduleOptions.MonthlyOptions.Period)`r`nDay Number In Month: $($BackupSettings.ScheduleOptions.MonthlyOptions.DayNumberInMonth)`r`nDay of Week: $($BackupSettings.ScheduleOptions.MonthlyOptions.DayOfWeek)`r`nDay of Month: $($BackupSettings.ScheduleOptions.MonthlyOptions.DayOfMonth)" } $inObj = [ordered] @{ @@ -48,9 +47,9 @@ function Get-AbrVbrConfigurationBackupSetting { 'Additional Address' = $BackupSettings.NotificationOptions.AdditionalAddress 'Email Subject' = $BackupSettings.NotificationOptions.NotificationSubject 'Notify On' = Switch ($BackupSettings.NotificationOptions.EnableAdditionalNotification) { - "" {"--"; break} - $Null {"--"; break} - default {"Notify On Success: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnSuccess)`r`nNotify On Warning: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnWarning)`r`nNotify On Error: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnError)`r`nNotify On Last Retry Only: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnLastRetryOnly)"} + "" { "--"; break } + $Null { "--"; break } + default { "Notify On Success: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnSuccess)`r`nNotify On Warning: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnWarning)`r`nNotify On Error: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnError)`r`nNotify On Last Retry Only: $(ConvertTo-TextYN $BackupSettings.NotificationOptions.NotifyOnLastRetryOnly)" } } 'NextRun' = $BackupSettings.NextRun 'Target' = $BackupSettings.Target @@ -58,17 +57,16 @@ function Get-AbrVbrConfigurationBackupSetting { 'LastResult' = $BackupSettings.LastResult } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Configuration Backup Settings Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Configuration Backup Settings Section: $($_.Exception.Message)" } if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Enabled' -like 'No'} | Set-Style -Style Warning -Property 'Enabled' - $OutObj | Where-Object { $_.'Run Job Automatically' -like 'No'} | Set-Style -Style Warning -Property 'Run Job Automatically' - $OutObj | Where-Object { $_.'Encryption Enabled' -like 'No'} | Set-Style -Style Critical -Property 'Encryption Enabled' - $OutObj | Where-Object { $_.'LastResult' -like 'Warning'} | Set-Style -Style Warning -Property 'LastResult' - $OutObj | Where-Object { $_.'LastResult' -like 'Failed'} | Set-Style -Style Critical -Property 'LastResult' + $OutObj | Where-Object { $_.'Enabled' -like 'No' } | Set-Style -Style Warning -Property 'Enabled' + $OutObj | Where-Object { $_.'Run Job Automatically' -like 'No' } | Set-Style -Style Warning -Property 'Run Job Automatically' + $OutObj | Where-Object { $_.'Encryption Enabled' -like 'No' } | Set-Style -Style Critical -Property 'Encryption Enabled' + $OutObj | Where-Object { $_.'LastResult' -like 'Warning' } | Set-Style -Style Warning -Property 'LastResult' + $OutObj | Where-Object { $_.'LastResult' -like 'Failed' } | Set-Style -Style Critical -Property 'LastResult' } $TableParams = @{ @@ -81,24 +79,24 @@ function Get-AbrVbrConfigurationBackupSetting { } $OutObj | Table @TableParams if ($HealthCheck.Infrastructure.BestPractice) { - if ($OutObj | Where-Object { $_.'Encryption Enabled' -like 'No' -or $_.'Run Job Automatically' -like 'No' -or $_.'Enabled' -like 'No' }) { + if ($OutObj | Where-Object { $_.'Encryption Enabled' -like 'No' -or $_.'Run Job Automatically' -like 'No' -or $_.'Enabled' -like 'No' }) { Paragraph "Health Check:" -Bold -Underline BlankLine - if ($OutObj | Where-Object { $_.'Encryption Enabled' -like 'No'} ) { + if ($OutObj | Where-Object { $_.'Encryption Enabled' -like 'No' } ) { Paragraph { Text "Best Practice:" - Bold Text "Whenever possible, enable configuration backup encryption." } BlankLine } - if ($OutObj | Where-Object { $_.'Run Job Automatically' -like 'No'}) { + if ($OutObj | Where-Object { $_.'Run Job Automatically' -like 'No' }) { Paragraph { Text "Best Practice:" - Bold Text "It's a recommended best practice to activate the 'Run job automatically' option of the Backup Configuration job." } BlankLine } - if ($OutObj | Where-Object { $_.'Enabled' -like 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled' -like 'No' }) { Paragraph { Text "Best Practice:" -Bold Text "It's a recommended best practice to enable the Backup Configuration job" @@ -108,9 +106,8 @@ function Get-AbrVbrConfigurationBackupSetting { } } } - } - catch { - Write-PscriboMessage -IsWarning "Configuration Backup Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Configuration Backup Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrCredential.ps1 b/Src/Private/Get-AbrVbrCredential.ps1 index 2b5f7e7..37eb51a 100644 --- a/Src/Private/Get-AbrVbrCredential.ps1 +++ b/Src/Private/Get-AbrVbrCredential.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrCredential { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrCredential { ) begin { - Write-PscriboMessage "Discovering Veeam VBR credential information from $System." + Write-PScriboMessage "Discovering Veeam VBR credential information from $System." } process { @@ -34,20 +34,19 @@ function Get-AbrVbrCredential { $OutObj = @() foreach ($Credential in $Credentials) { try { - Write-PscriboMessage "Discovered $($Credential.Name) Server." + Write-PScriboMessage "Discovered $($Credential.Name) Server." $inObj = [ordered] @{ 'Name' = $Credential.Name 'Change Time' = Switch ($Credential.ChangeTimeUtc) { - "" {"--"; break} - $Null {'--'; break} - default {$Credential.ChangeTimeUtc.ToShortDateString()} + "" { "--"; break } + $Null { '--'; break } + default { $Credential.ChangeTimeUtc.ToShortDateString() } } 'Description' = $Credential.Description } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Security Credentials $($Credential.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Security Credentials $($Credential.Name) Section: $($_.Exception.Message)" } } @@ -69,15 +68,14 @@ function Get-AbrVbrCredential { $OutObj = @() foreach ($CloudCredential in $CloudCredentials) { try { - Write-PscriboMessage "Discovered $($CloudCredential.Name) Server." + Write-PScriboMessage "Discovered $($CloudCredential.Name) Server." $inObj = [ordered] @{ 'Name' = $CloudCredential.Name 'Description' = $CloudCredential.Description } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Service Provider Credentials $($CloudCredential.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Service Provider Credentials $($CloudCredential.Name) Section: $($_.Exception.Message)" } } @@ -92,15 +90,13 @@ function Get-AbrVbrCredential { $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Service Provider Credentials Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Service Provider Credentials Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Security Credentials Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Security Credentials Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrEmailNotificationSetting.ps1 b/Src/Private/Get-AbrVbrEmailNotificationSetting.ps1 index a7bc8d8..4610b6c 100644 --- a/Src/Private/Get-AbrVbrEmailNotificationSetting.ps1 +++ b/Src/Private/Get-AbrVbrEmailNotificationSetting.ps1 @@ -21,7 +21,7 @@ function Get-AbrVbrEmailNotificationSetting { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Email Notification settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR Email Notification settings information from $System." } process { @@ -42,16 +42,16 @@ function Get-AbrVbrEmailNotificationSetting { 'Daily Reports Time' = $EmailSetting.DailyReportsTime.ToShortTimeString() 'Enabled' = ConvertTo-TextYN $EmailSetting.Enabled 'Notify On' = Switch ($EmailSetting.NotifyOnSuccess) { - "" {"--"; break} - $Null {"--"; break} - default {"Notify On Success: $(ConvertTo-TextYN $EmailSetting.NotifyOnSuccess)`r`nNotify On Warning: $(ConvertTo-TextYN $EmailSetting.NotifyOnWarning)`r`nNotify On Failure: $(ConvertTo-TextYN $EmailSetting.NotifyOnFailure)`r`nNotify On Last Retry Only: $(ConvertTo-TextYN $EmailSetting.NotifyOnLastRetryOnly)"} + "" { "--"; break } + $Null { "--"; break } + default { "Notify On Success: $(ConvertTo-TextYN $EmailSetting.NotifyOnSuccess)`r`nNotify On Warning: $(ConvertTo-TextYN $EmailSetting.NotifyOnWarning)`r`nNotify On Failure: $(ConvertTo-TextYN $EmailSetting.NotifyOnFailure)`r`nNotify On Last Retry Only: $(ConvertTo-TextYN $EmailSetting.NotifyOnLastRetryOnly)" } } } $OutObj += [pscustomobject]$inobj } if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Enabled' -like 'No'} | Set-Style -Style Warning -Property 'Enabled' + $OutObj | Where-Object { $_.'Enabled' -like 'No' } | Set-Style -Style Warning -Property 'Enabled' } $TableParams = @{ @@ -73,9 +73,8 @@ function Get-AbrVbrEmailNotificationSetting { } } } - } - catch { - Write-PscriboMessage -IsWarning "Email Notification Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Email Notification Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrEnterpriseManagerInfo.ps1 b/Src/Private/Get-AbrVbrEnterpriseManagerInfo.ps1 index bfe1bab..9accb52 100644 --- a/Src/Private/Get-AbrVbrEnterpriseManagerInfo.ps1 +++ b/Src/Private/Get-AbrVbrEnterpriseManagerInfo.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrEnterpriseManagerInfo { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrEnterpriseManagerInfo { ) begin { - Write-PscriboMessage "Discovering Enterprise Manager information from $System." + Write-PScriboMessage "Discovering Enterprise Manager information from $System." } process { @@ -33,17 +33,17 @@ function Get-AbrVbrEnterpriseManagerInfo { BlankLine $OutObj = @() foreach ($BackupServer in $BackupServers) { - Write-PscriboMessage "Collecting Enterprise Manager information from $($BackupServer.Name)." - $EMInfo = [Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() + Write-PScriboMessage "Collecting Enterprise Manager information from $($BackupServer.Name)." + $EMInfo = [Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() if ($EMInfo) { $inObj = [ordered] @{ 'Server Name' = Switch ([string]::IsNullOrEmpty($EMInfo.ServerName)) { - $true {'Not Connected'} - default {$EMInfo.ServerName} + $true { 'Not Connected' } + default { $EMInfo.ServerName } } 'Server URL' = Switch ([string]::IsNullOrEmpty($EMInfo.URL)) { - $true {'Not Connected'} - default {$EMInfo.URL} + $true { 'Not Connected' } + default { $EMInfo.URL } } 'Skip License Push' = ConvertTo-TextYN $EMInfo.SkipLicensePush 'Is Connected' = ConvertTo-TextYN $EMInfo.IsConnected @@ -79,9 +79,8 @@ function Get-AbrVbrEnterpriseManagerInfo { } } } - } - catch { - Write-PscriboMessage -IsWarning "Enterprise Manager Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Enterprise Manager Information Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrEventForwarding.ps1 b/Src/Private/Get-AbrVbrEventForwarding.ps1 index 75cb8e9..f15eca8 100644 --- a/Src/Private/Get-AbrVbrEventForwarding.ps1 +++ b/Src/Private/Get-AbrVbrEventForwarding.ps1 @@ -20,32 +20,32 @@ function Get-AbrVbrEventForwarding { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Event Forwarding settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR Event Forwarding settings information from $System." } process { try { $SNMPSettings = (Get-VBRSNMPOptions).Receiver - $SyslogSettings = try {Get-VBRSyslogServer} catch { Write-PScriboMessage "No syslog server configured"} + $SyslogSettings = try { Get-VBRSyslogServer } catch { Write-PScriboMessage "No syslog server configured" } Section -Style Heading4 'Event Forwarding' { $OutObj = @() $inObj = [ordered] @{ 'SNMP Servers' = Switch ([string]::IsNullOrEmpty($SNMPSettings)) { - $true {"--"} - $false {$SNMPSettings | ForEach-Object {"Receiver: $($_.ReceiverIP), Port: $($_.ReceiverPort), Community: $($_.CommunityString)"}} - default {"Unknown"} + $true { "--" } + $false { $SNMPSettings | ForEach-Object { "Receiver: $($_.ReceiverIP), Port: $($_.ReceiverPort), Community: $($_.CommunityString)" } } + default { "Unknown" } } 'Syslog Servers' = Switch ([string]::IsNullOrEmpty($SyslogSettings)) { - $true {"--"} - $false {$SyslogSettings | ForEach-Object {"Receiver: $($_.ServerHost), Port: $($_.Port), Protocol: $($_.Protocol)"}} - default {"Unknown"} + $true { "--" } + $false { $SyslogSettings | ForEach-Object { "Receiver: $($_.ServerHost), Port: $($_.Port), Protocol: $($_.Protocol)" } } + default { "Unknown" } } } $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Syslog Servers' -eq '--'} | Set-Style -Style Warning -Property 'Syslog Servers' + $OutObj | Where-Object { $_.'Syslog Servers' -eq '--' } | Set-Style -Style Warning -Property 'Syslog Servers' } $TableParams = @{ @@ -57,7 +57,7 @@ function Get-AbrVbrEventForwarding { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - if ($HealthCheck.Infrastructure.BestPractice -and ($OutObj | Where-Object { $_.'Syslog Servers' -eq '--'})) { + if ($HealthCheck.Infrastructure.BestPractice -and ($OutObj | Where-Object { $_.'Syslog Servers' -eq '--' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -66,9 +66,8 @@ function Get-AbrVbrEventForwarding { } } } - } - catch { - Write-PscriboMessage -IsWarning "Event Forwarding Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Event Forwarding Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrFileShareBackupjob.ps1 b/Src/Private/Get-AbrVbrFileShareBackupjob.ps1 index 519ae5e..04e2513 100644 --- a/Src/Private/Get-AbrVbrFileShareBackupjob.ps1 +++ b/Src/Private/Get-AbrVbrFileShareBackupjob.ps1 @@ -21,12 +21,12 @@ function Get-AbrVbrFileShareBackupjob { ) begin { - Write-PscriboMessage "Discovering Veeam VBR File Share Backup jobs information from $System." + 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' -or $_.TypeToString -like 'Object Storage Backup'} + $FSBkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -like 'File Backup' -or $_.TypeToString -like 'Object Storage Backup' } if ($FSBkjobs.count -gt 0) { if ($VbrVersion -lt 12.1) { $BSName = 'File Share Backup Jobs' @@ -39,24 +39,23 @@ function Get-AbrVbrFileShareBackupjob { $OutObj = @() foreach ($FSBkjob in $FSBkjobs) { try { - Write-PscriboMessage "Discovered $($FSBkjob.Name) $($BSName.ToLower())." + Write-PScriboMessage "Discovered $($FSBkjob.Name) $($BSName.ToLower())." $inObj = [ordered] @{ 'Name' = $FSBkjob.Name 'Type' = $FSBkjob.TypeToString 'Status' = Switch ($FSBkjob.IsScheduleEnabled) { - 'False' {'Disabled'} - 'True' {'Enabled'} + 'False' { 'Disabled' } + 'True' { 'Enabled' } } 'Latest Result' = $FSBkjob.info.LatestStatus 'Last Run' = Switch ($FSBkjob.FindLastSession()) { - $Null {'Unknown'} - default {$FSBkjob.FindLastSession().EndTimeUTC} + $Null { 'Unknown' } + default { $FSBkjob.FindLastSession().EndTimeUTC } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($BSName.ToLower()) $($FSBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "$($BSName.ToLower()) $($FSBkjob.Name) Section: $($_.Exception.Message)" } } @@ -75,12 +74,11 @@ function Get-AbrVbrFileShareBackupjob { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $OutObj | Sort-Object -Property 'Name' |Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($BSName.ToLower()) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "$($BSName.ToLower()) Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrFileShareBackupjobConf.ps1 b/Src/Private/Get-AbrVbrFileShareBackupjobConf.ps1 index c790347..ed92be1 100644 --- a/Src/Private/Get-AbrVbrFileShareBackupjobConf.ps1 +++ b/Src/Private/Get-AbrVbrFileShareBackupjobConf.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrFileShareBackupjobConf { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,11 +21,11 @@ function Get-AbrVbrFileShareBackupjobConf { ) begin { - Write-PscriboMessage "Discovering Veeam VBR File Share Backup jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR File Share Backup jobs information from $System." } process { - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object {$_.TypeToString -like 'File Backup' -or $_.TypeToString -like 'Object Storage Backup'} + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -like 'File Backup' -or $_.TypeToString -like 'Object Storage Backup' } if (($Bkjobs).count -gt 0) { if ($VbrVersion -lt 12.1) { $BSName = 'File Share Backup Jobs Configuration' @@ -41,10 +41,10 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading4 -ExcludeFromTOC 'Common Information' { $OutObj = @() try { - $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue -Name $Bkjob.Name | Where-object {$_.TypeToString -ne 'Windows Agent Backup'}).Info + $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue -Name $Bkjob.Name | Where-Object { $_.TypeToString -ne 'Windows Agent Backup' }).Info foreach ($CommonInfo in $CommonInfos) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) common information." + Write-PScriboMessage "Discovered $($Bkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString @@ -55,9 +55,8 @@ function Get-AbrVbrFileShareBackupjobConf { 'Modified By' = $CommonInfo.CommonInfo.ModifiedBy.FullName } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Common Information $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Common Information $($Bkjob.Name) Section: $($_.Exception.Message)" } } @@ -76,7 +75,7 @@ function Get-AbrVbrFileShareBackupjobConf { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -86,9 +85,8 @@ function Get-AbrVbrFileShareBackupjobConf { BlankLine } } - } - catch { - Write-PscriboMessage -IsWarning "Common Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Common Information Section: $($_.Exception.Message)" } } if ($Bkjob.TypeToString -ne "Object Storage Backup") { @@ -96,8 +94,8 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC "Files and Folders" { $OutObj = @() try { - foreach ($OBJ in ($Bkjob.GetObjectsInJob() | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "Exclude"})) { - Write-PscriboMessage "Discovered $($OBJ.Name) files and folders to backup." + foreach ($OBJ in ($Bkjob.GetObjectsInJob() | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "Exclude" })) { + Write-PScriboMessage "Discovered $($OBJ.Name) files and folders to backup." $inObj = [ordered] @{ 'Name' = $OBJ.Name 'Resource Type' = $OBJ.TypeDisplayName @@ -119,40 +117,39 @@ function Get-AbrVbrFileShareBackupjobConf { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Files and Folders Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Files and Folders Section: $($_.Exception.Message)" } } } } else { - if ((Get-VBRUnstructuredBackupJob -id $Bkjob.Id).BackupObject) { + if ((Get-VBRUnstructuredBackupJob -Id $Bkjob.Id).BackupObject) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Objects" { $OutObj = @() try { - foreach ($OBJ in ((Get-VBRUnstructuredBackupJob -id $Bkjob.Id).BackupObject)) { - Write-PscriboMessage "Discovered $($OBJ.Name) object to backup." + foreach ($OBJ in ((Get-VBRUnstructuredBackupJob -Id $Bkjob.Id).BackupObject)) { + Write-PScriboMessage "Discovered $($OBJ.Name) object to backup." $inObj = [ordered] @{ 'Name' = $OBJ.Server.FriendlyName 'Path' = Switch ([string]::IsNullOrEmpty($OBJ.Path)) { - $true {"--"} - $false {$OBJ.Path} - default {"Unknown"} + $true { "--" } + $false { $OBJ.Path } + default { "Unknown" } } 'Container' = Switch ([string]::IsNullOrEmpty($OBJ.Container)) { - $true {"--"} - $false {$OBJ.Container} - default {"Unknown"} + $true { "--" } + $false { $OBJ.Container } + default { "Unknown" } } 'Inclusion Mask' = Switch ([string]::IsNullOrEmpty($OBJ.InclusionMask)) { - $true {"--"} - $false {$OBJ.InclusionMask} - default {"Unknown"} + $true { "--" } + $false { $OBJ.InclusionMask } + default { "Unknown" } } 'Exclusion Mask' = Switch ([string]::IsNullOrEmpty($OBJ.ExclusionMask)) { - $true {"--"} - $false {$OBJ.ExclusionMask} - default {"Unknown"} + $true { "--" } + $false { $OBJ.ExclusionMask } + default { "Unknown" } } } $OutObj += [pscustomobject]$inobj @@ -166,9 +163,8 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Objects Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Objects Section: $($_.Exception.Message)" } } } @@ -176,25 +172,25 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Storage' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." $inObj = [ordered] @{ 'Backup 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} + '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 } } 'Keep all file versions for the last' = "$($Bkjob.Options.NasBackupRetentionPolicy.ShortTermRetention) $($Bkjob.Options.NasBackupRetentionPolicy.ShortTermRetentionUnit)" } $FiletoArchive = Switch ($Bkjob.Options.NasBackupRetentionPolicy.ArchiveFileExtensionsScope) { - 'ExceptSpecified' {"All file exept the following extension: $($Bkjob.Options.NasBackupRetentionPolicy.ExcludedFileExtensions)"} - 'Any' {'All Files: *.*'} - 'Specified' {"File with the following extension only: $($Bkjob.Options.NasBackupRetentionPolicy.IncludedFileExtensions)"} + 'ExceptSpecified' { "All file exept the following extension: $($Bkjob.Options.NasBackupRetentionPolicy.ExcludedFileExtensions)" } + 'Any' { 'All Files: *.*' } + 'Specified' { "File with the following extension only: $($Bkjob.Options.NasBackupRetentionPolicy.IncludedFileExtensions)" } } if ($Bkjob.Options.NasBackupRetentionPolicy.LongTermEnabled -and ($VbrVersion -lt 12.1)) { $inObj.add('Keep previous file versions for', "$($Bkjob.Options.NasBackupRetentionPolicy.LongTermRetention) $($Bkjob.Options.NasBackupRetentionPolicy.LongTermRetentionUnit)") - $inObj.add('Archive repository', (Get-VBRNASBackupJob -WarningAction SilentlyContinue | Where-Object {$_.id -eq $BKjob.id}).LongTermBackupRepository.Name) + $inObj.add('Archive repository', (Get-VBRNASBackupJob -WarningAction SilentlyContinue | Where-Object { $_.id -eq $BKjob.id }).LongTermBackupRepository.Name) $inObj.add('File to Archive', $FiletoArchive) } @@ -218,11 +214,11 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings ($FLVersion)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) File Version options." + Write-PScriboMessage "Discovered $($Bkjob.Name) File Version options." $FileVersionsRetentionScope = Switch ($Bkjob.Options.NasBackupRetentionPolicy.FileVersionsRetentionScope) { - 'LongTermOnly' {'Limit the number of archived file versions only'} - 'None' {'Keep all file versions'} - 'All' {'Limit the number of both recent and archived file versions'} + 'LongTermOnly' { 'Limit the number of archived file versions only' } + 'None' { 'Keep all file versions' } + 'All' { 'Limit the number of both recent and archived file versions' } } $inObj = [ordered] @{ 'File version to keep' = $FileVersionsRetentionScope @@ -244,9 +240,8 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings ($FLVersion) $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings ($FLVersion) $($Bkjob.Name) Section: $($_.Exception.Message)" } } } @@ -254,12 +249,12 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (ACL Handling)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) acl handling options." + Write-PScriboMessage "Discovered $($Bkjob.Name) acl handling options." $inObj = [ordered] @{ 'Permissions and attribute backup' = Switch ($Bkjob.Options.NasBackupOptions.FileAttributesChangeTrackingMode) { - 'TrackOnlyFolderAttributesChanges' {'Folder-level only (recommended)'} - 'TrackEverythingAttributesChanges' {'File and folders (slower)'} - default {"--"} + 'TrackOnlyFolderAttributesChanges' { 'Folder-level only (recommended)' } + 'TrackEverythingAttributesChanges' { 'File and folders (slower)' } + default { "--" } } } $OutObj = [pscustomobject]$inobj @@ -273,9 +268,8 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (acl handling) $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (acl handling) $($Bkjob.Name) Section: $($_.Exception.Message)" } } } @@ -283,21 +277,21 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Storage)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." $inObj = [ordered] @{ 'Inline Data Deduplication' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.EnableDeduplication 'Compression Level' = Switch ($Bkjob.Options.BackupStorageOptions.CompressionLevel) { - 0 {'NONE'} - -1 {'AUTO'} - 4 {'DEDUPE_friendly'} - 5 {'OPTIMAL (Default)'} - 6 {'High'} - 9 {'EXTREME'} + 0 { 'NONE' } + -1 { 'AUTO' } + 4 { 'DEDUPE_friendly' } + 5 { 'OPTIMAL (Default)' } + 6 { 'High' } + 9 { 'EXTREME' } } 'Enabled Backup File Encryption' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled 'Encryption Key' = Switch ($Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled) { - $false {'None'} - default {(Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description} + $false { 'None' } + default { (Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description } } } $OutObj = [pscustomobject]$inobj @@ -311,9 +305,8 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Storage) $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Storage) $($Bkjob.Name) Section: $($_.Exception.Message)" } } } @@ -321,7 +314,7 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($Bkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $Bkjob.Options.GenerationPolicy.EnableRechek 'SLCG Schedule Type' = $Bkjob.Options.GenerationPolicy.RecheckScheduleKind @@ -358,9 +351,8 @@ function Get-AbrVbrFileShareBackupjobConf { } } } - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Maintenance) $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Maintenance) $($Bkjob.Name) Section: $($_.Exception.Message)" } } } @@ -368,7 +360,7 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) notification options." + Write-PScriboMessage "Discovered $($Bkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SnmpNotification 'Send Email Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SendEmailNotification2AdditionalAddresses @@ -395,9 +387,8 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Notification) $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Notification) $($Bkjob.Name) Section: $($_.Exception.Message)" } } } @@ -408,12 +399,11 @@ function Get-AbrVbrFileShareBackupjobConf { if ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Days') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Days -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { + } elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($Bkjob.Name) script options." + Write-PScriboMessage "Discovered $($Bkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $Bkjob.Options.JobScriptCommand.PreScriptEnabled 'Run Script Before the Job' = $Bkjob.Options.JobScriptCommand.PreScriptCommandLine @@ -434,23 +424,21 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Script) $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Script) $($Bkjob.Name) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Storage Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Storage Options Section: $($_.Exception.Message)" } } - $ArchiveRepoTarget = Get-VBRUnstructuredBackupJob -id $Bkjob.Id + $ArchiveRepoTarget = Get-VBRUnstructuredBackupJob -Id $Bkjob.Id if ($ArchiveRepoTarget.LongTermRetentionPeriodEnabled) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Archive Repository" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) archive repository." + Write-PScriboMessage "Discovered $($Bkjob.Name) archive repository." try { $inObj = [ordered] @{ 'Backup Repository ' = $ArchiveRepoTarget.LongTermBackupRepository.Name @@ -468,9 +456,8 @@ function Get-AbrVbrFileShareBackupjobConf { $inObj.add("Description", $ArchiveRepoTarget.LongTermBackupRepository.Description) $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Archive Repository $($ArchiveRepoTarget.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Archive Repository $($ArchiveRepoTarget.Name) Section: $($_.Exception.Message)" } $TableParams = @{ Name = "Archive Repository - $($Bkjob.Name)" @@ -481,19 +468,18 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Job Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Archive Repository Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Archive Repository Section: $($_.Exception.Message)" } } } - $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($Bkjob.Id) | Where-Object {$_.JobType -ne 'SimpleBackupCopyWorker'} + $SecondaryTargets = [Veeam.Backup.Core.CBackupJob]::GetSecondDestinationJobs($Bkjob.Id) | Where-Object { $_.JobType -ne 'SimpleBackupCopyWorker' } if ($SecondaryTargets) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Secondary Target" { $OutObj = @() try { foreach ($SecondaryTarget in $SecondaryTargets) { - Write-PscriboMessage "Discovered $($Bkjob.Name) secondary target." + Write-PScriboMessage "Discovered $($Bkjob.Name) secondary target." try { $inObj = [ordered] @{ 'Job Name' = $SecondaryTarget.Name @@ -502,9 +488,8 @@ function Get-AbrVbrFileShareBackupjobConf { 'Description' = $SecondaryTarget.Description } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Secondary Target $($SecondaryTarget.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Secondary Target $($SecondaryTarget.Name) Section: $($_.Exception.Message)" } } $TableParams = @{ @@ -516,9 +501,8 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Job Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Secondary Destination Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Secondary Destination Jobs Section: $($_.Exception.Message)" } } } @@ -526,20 +510,17 @@ function Get-AbrVbrFileShareBackupjobConf { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." if ($Bkjob.ScheduleOptions.OptionsDaily.Enabled -eq "True") { $ScheduleType = "Daily" $Schedule = "Kind: $($Bkjob.ScheduleOptions.OptionsDaily.Kind),`r`nDays: $($Bkjob.ScheduleOptions.OptionsDaily.DaysSrv)" - } - elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfMonth),`r`nDay Number In Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayNumberInMonth),`r`nDay Of Week: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfWeek)" - } - elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { $ScheduleType = $Bkjob.ScheduleOptions.OptionsPeriodically.Kind $Schedule = "Full Period: $($Bkjob.ScheduleOptions.OptionsPeriodically.FullPeriod),`r`nHourly Offset: $($Bkjob.ScheduleOptions.OptionsPeriodically.HourlyOffset),`r`nUnit: $($Bkjob.ScheduleOptions.OptionsPeriodically.Unit)" - } - elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { $ScheduleType = 'Continuous' $Schedule = "Schedule Time Period" } @@ -547,13 +528,13 @@ function Get-AbrVbrFileShareBackupjobConf { 'Retry Failed item' = $Bkjob.ScheduleOptions.RetryTimes 'Wait before each retry' = "$($Bkjob.ScheduleOptions.RetryTimeout)/min" 'Backup Window' = Switch ($Bkjob.TypeToString) { - "Backup Copy" {ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsContinuous.Enabled} - default {ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled} + "Backup Copy" { ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsContinuous.Enabled } + default { ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled } } 'Shedule type' = $ScheduleType 'Shedule Options' = $Schedule - 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() - 'Latest Run' = $Bkjob.LatestRunLocal + 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() + 'Latest Run' = $Bkjob.LatestRunLocal } $OutObj = [pscustomobject]$inobj @@ -582,10 +563,9 @@ function Get-AbrVbrFileShareBackupjobConf { $Regex = [Regex]::new("(?<=<$Day>)(.*)(?=)") if ($Bkjob.TypeToString -eq "VMware Backup Copy") { $BackupWindow = $Bkjob.ScheduleOptions.OptionsContinuous.Schedule - } else {$BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow} + } else { $BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow } $Match = $Regex.Match($BackupWindow) - if($Match.Success) - { + if ($Match.Success) { $ScheduleTimePeriod += $Match.Value } } @@ -595,7 +575,7 @@ function Get-AbrVbrFileShareBackupjobConf { $TableParams = @{ Name = "Backup Window - $($Bkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -603,39 +583,36 @@ function Get-AbrVbrFileShareBackupjobConf { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style ON -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style ON -Property "Sat" - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style OFF -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style OFF -Property "Sat" $OutObj2 } - } - catch { - Write-PscriboMessage -IsWarning "Backup Window Time Period Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Backup Window Time Period Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Schedule Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Schedule Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "$($BSName) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "$($BSName) Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrFileSharesInfo.ps1 b/Src/Private/Get-AbrVbrFileSharesInfo.ps1 index 04fecdd..f8a6766 100644 --- a/Src/Private/Get-AbrVbrFileSharesInfo.ps1 +++ b/Src/Private/Get-AbrVbrFileSharesInfo.ps1 @@ -21,7 +21,7 @@ function Get-AbrVbrFileSharesInfo { ) begin { - Write-PscriboMessage "Discovering Veeam VBR File Share information from $System." + Write-PScriboMessage "Discovering Veeam VBR File Share information from $System." } process { @@ -42,29 +42,28 @@ function Get-AbrVbrFileSharesInfo { $Path = Get-VBRNASServerPath -Server $ShareObj $AccessCredentials = $ShareObj.AccessCredentials } - Write-PscriboMessage "Discovered $($Path) Share." + Write-PScriboMessage "Discovered $($Path) Share." $inObj = [ordered] @{ 'Path' = $Path 'Type' = switch ($ShareObj.Type) { - "FileServer" {"File Server"} - "SANSMB" {"NAS Filler"} - "SMB" {"SMB Share"} - "NFS" {"NFS Share"} - "SANNFS" {"NAS Filler"} - Default {$ShareObj.Type} + "FileServer" { "File Server" } + "SANSMB" { "NAS Filler" } + "SMB" { "SMB Share" } + "NFS" { "NFS Share" } + "SANNFS" { "NAS Filler" } + Default { $ShareObj.Type } } 'Backup IO Control' = $ShareObj.BackupIOControlLevel 'Credentials' = Switch (($AccessCredentials).count) { - 0 {"None"} - default {$AccessCredentials} + 0 { "None" } + default { $AccessCredentials } } 'Cache Repository' = $ShareObj.CacheRepository.Name } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "File Shares $($Path) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "File Shares $($Path) Section: $($_.Exception.Message)" } } @@ -77,10 +76,9 @@ function Get-AbrVbrFileSharesInfo { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $OutObj | Sort-object -Property 'Path' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "File Shares Section: $($_.Exception.Message)" + $OutObj | Sort-Object -Property 'Path' | Table @TableParams + } catch { + Write-PScriboMessage -IsWarning "File Shares Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrFileToTape.ps1 b/Src/Private/Get-AbrVbrFileToTape.ps1 index 77ba5a6..8a8fdbf 100644 --- a/Src/Private/Get-AbrVbrFileToTape.ps1 +++ b/Src/Private/Get-AbrVbrFileToTape.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrFileToTape { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrFileToTape { ) begin { - Write-PscriboMessage "Discovering Veeam VBR File to Tape Backup jobs configuration information from $System." + Write-PScriboMessage "Discovering Veeam VBR File to Tape Backup jobs configuration information from $System." } process { try { - $TBkjobs = Get-VBRTapeJob | Where-Object {$_.Type -eq 'FileToTape'} | Sort-Object -Property Name + $TBkjobs = Get-VBRTapeJob | Where-Object { $_.Type -eq 'FileToTape' } | Sort-Object -Property Name if ($TBkjobs) { Section -Style Heading3 'File To Tape Job Configuration' { Paragraph "The following section details the configuration about file to tape jobs." @@ -38,13 +38,13 @@ function Get-AbrVbrFileToTape { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Backups Information' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) common information." + Write-PScriboMessage "Discovered $($TBkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $TBkjob.Name 'Type' = $TBkjob.Type 'Next Run' = Switch ($TBkjob.Enabled) { - 'False' {'Disabled'} - default {$TBkjob.NextRun} + 'False' { 'Disabled' } + default { $TBkjob.NextRun } } 'Description' = $TBkjob.Description } @@ -65,7 +65,7 @@ function Get-AbrVbrFileToTape { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -74,9 +74,8 @@ function Get-AbrVbrFileToTape { } } } - } - catch { - Write-PscriboMessage -IsWarning "Common Information $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Common Information $($TBkjob.Name) Section: $($_.Exception.Message)" } } if ($TBkjob.Object) { @@ -85,7 +84,7 @@ function Get-AbrVbrFileToTape { $OutObj = @() foreach ($File in $TBkjob.Object) { try { - Write-PscriboMessage "Discovered $($File.Name) files and folders to process." + Write-PScriboMessage "Discovered $($File.Name) files and folders to process." $inObj = [ordered] @{ 'Name' = $File.Server.Name 'Type' = $File.Server.Type @@ -95,19 +94,18 @@ function Get-AbrVbrFileToTape { 'Exclude Filter' = ConvertTo-EmptyToFiller $File.ExcludeMask } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Files and Folders $($File.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Files and Folders $($File.Name) Section: $($_.Exception.Message)" } } if ($TBkjob.NdmpObject) { foreach ($NDMP in $TBkjob.NdmpObject) { try { - Write-PscriboMessage "Discovered $($NDMP.Name) NDMP to process." + Write-PScriboMessage "Discovered $($NDMP.Name) NDMP to process." $inObj2 = [ordered] @{ 'Name' = Switch ((Get-VBRNDMPServer -Id $NDMP.ServerId).Name) { - $Null {'NDMP Object'} - default {(Get-VBRNDMPServer -Id $NDMP.ServerId).Name} + $Null { 'NDMP Object' } + default { (Get-VBRNDMPServer -Id $NDMP.ServerId).Name } } 'Type' = 'NDMP' 'Selection Type' = 'Directory' @@ -116,9 +114,8 @@ function Get-AbrVbrFileToTape { 'Exclude Filter' = '--' } $OutObj += [pscustomobject]$inobj2 - } - catch { - Write-PscriboMessage -IsWarning "Files and Folders $($NDMP.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Files and Folders $($NDMP.Name) Section: $($_.Exception.Message)" } } } @@ -133,9 +130,8 @@ function Get-AbrVbrFileToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Files and Folders Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Files and Folders Section: $($_.Exception.Message)" } } if ($TBkjob.FullBackupMediaPool) { @@ -144,7 +140,7 @@ function Get-AbrVbrFileToTape { $OutObj = @() foreach ($BackupMediaPool in $TBkjob.FullBackupMediaPool) { try { - Write-PscriboMessage "Discovered $($TBkjob.Name) media pool." + Write-PScriboMessage "Discovered $($TBkjob.Name) media pool." $inObj = [ordered] @{ 'Name' = $BackupMediaPool.Name 'Pool Type' = $BackupMediaPool.Type @@ -157,11 +153,10 @@ function Get-AbrVbrFileToTape { if ($BackupMediaPool.Type -eq "Custom" -and $TBkjob.FullBackupPolicy.Enabled) { if ($TBkjob.FullBackupPolicy.Type -eq 'Daily') { $inObj.add('Daily at this Time', ("$($TBkjob.FullBackupPolicy.DailyOptions.Period) - $($TBkjob.FullBackupPolicy.DailyOptions.DayOfWeek -join ", ")")) - } - elseif ($TBkjob.FullBackupPolicy.Type -eq 'Monthly') { + } elseif ($TBkjob.FullBackupPolicy.Type -eq 'Monthly') { $Months = Switch (($TBkjob.FullBackupPolicy.MonthlyOptions.Months).count) { - 12 {'Every Month'} - default {$TBkjob.FullBackupPolicy.MonthlyOptions.Months -join ", "} + 12 { 'Every Month' } + default { $TBkjob.FullBackupPolicy.MonthlyOptions.Months -join ", " } } if ($TBkjob.FullBackupPolicy.MonthlyOptions.DayNumberInMonth -eq 'OnDay') { $inObj.add('Monthly at this Time', ("At $($TBkjob.FullBackupPolicy.DailyOptions.Period), Monthly on the: $($TBkjob.FullBackupPolicy.MonthlyOptions.DayOfMonth) day of $Months")) @@ -171,9 +166,8 @@ function Get-AbrVbrFileToTape { } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Full Backup $($BackupMediaPool.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Full Backup $($BackupMediaPool.Name) Section: $($_.Exception.Message)" } } @@ -187,9 +181,8 @@ function Get-AbrVbrFileToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Full Backup Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Full Backup Section: $($_.Exception.Message)" } } if ($TBkjob.IncrementalBackupPolicy) { @@ -198,7 +191,7 @@ function Get-AbrVbrFileToTape { $OutObj = @() foreach ($BackupMediaPool in $TBkjob.IncrementalBackupMediaPool) { try { - Write-PscriboMessage "Discovered $($TBkjob.Name) incremental backup." + Write-PScriboMessage "Discovered $($TBkjob.Name) incremental backup." $inObj = [ordered] @{ 'Name' = $BackupMediaPool.Name 'Pool Type' = $BackupMediaPool.Type @@ -211,11 +204,10 @@ function Get-AbrVbrFileToTape { if ($BackupMediaPool.Type -eq "Custom" -and $TBkjob.IncrementalBackupPolicy.Enabled) { if ($TBkjob.IncrementalBackupPolicy.Type -eq 'Daily') { $inObj.add('Daily at this Time', ("$($TBkjob.IncrementalBackupPolicy.DailyOptions.Period) - $($TBkjob.IncrementalBackupPolicy.DailyOptions.DayOfWeek -join ", ")")) - } - elseif ($TBkjob.IncrementalBackupPolicy.Type -eq 'Monthly') { + } elseif ($TBkjob.IncrementalBackupPolicy.Type -eq 'Monthly') { $Months = Switch (($TBkjob.IncrementalBackupPolicy.MonthlyOptions.Months).count) { - 12 {'Every Month'} - default {$TBkjob.IncrementalBackupPolicy.MonthlyOptions.Months -join ", "} + 12 { 'Every Month' } + default { $TBkjob.IncrementalBackupPolicy.MonthlyOptions.Months -join ", " } } if ($TBkjob.IncrementalBackupPolicy.MonthlyOptions.DayNumberInMonth -eq 'OnDay') { $inObj.add('Monthly at this Time', ("At $($TBkjob.IncrementalBackupPolicy.DailyOptions.Period), Monthly on the: $($TBkjob.IncrementalBackupPolicy.MonthlyOptions.DayOfMonth) day of $Months")) @@ -225,9 +217,8 @@ function Get-AbrVbrFileToTape { } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Incremental Backup $($BackupMediaPool.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Incremental Backup $($BackupMediaPool.Name) Section: $($_.Exception.Message)" } } @@ -241,25 +232,23 @@ function Get-AbrVbrFileToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Incremental Backup $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Incremental Backup $($TBkjob.Name) Section: $($_.Exception.Message)" } } try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Options' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) options." + Write-PScriboMessage "Discovered $($TBkjob.Name) options." $inObj = [ordered] @{ 'Use Microsoft volume shadow copy (VSS)' = ConvertTo-TextYN $TBkjob.UseVss 'Eject Tape Media Upon Job Completion' = ConvertTo-TextYN $TBkjob.EjectCurrentMedium 'Export the following MediaSet Upon Job Completion' = ConvertTo-TextYN $TBkjob.ExportCurrentMediaSet } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Options $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Options $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -276,15 +265,14 @@ function Get-AbrVbrFileToTape { Section -Style NOTOCHeading6 -ExcludeFromTOC 'Advanced Settings (Notifications)' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) notification options." + Write-PScriboMessage "Discovered $($TBkjob.Name) notification options." $inObj = [ordered] @{ 'Send Email Notification' = ConvertTo-TextYN $TBkjob.NotificationOptions.EnableAdditionalNotification 'Email Notification Additional Recipients' = $TBkjob.NotificationOptions.AdditionalAddress -join "," } if (!$TBkjob.NotificationOptions.UseNotificationOptions) { $inObj.add('Use Global Notification Settings', (ConvertTo-TextYN $TBkjob.NotificationOptions.UseNotificationOptions)) - } - elseif ($TBkjob.NotificationOptions.UseNotificationOptions) { + } elseif ($TBkjob.NotificationOptions.UseNotificationOptions) { $inObj.add('Use Custom Notification Settings', ('Yes')) $inObj.add('Subject', ($TBkjob.NotificationOptions.NotificationSubject)) $inObj.add('Notify On Success', (ConvertTo-TextYN $TBkjob.NotificationOptions.NotifyOnSuccess)) @@ -294,9 +282,8 @@ function Get-AbrVbrFileToTape { $inObj.add('Notify When Waiting For Tape', (ConvertTo-TextYN $TBkjob.NotificationOptions.NotifyWhenWaitingForTape)) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Notifications) $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Notifications) $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -309,9 +296,8 @@ function Get-AbrVbrFileToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Notifications) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Notifications) Section: $($_.Exception.Message)" } } if ($InfoLevel.Jobs.Tape -ge 2 -and $TBkjob.NotificationOptions.EnableAdditionalNotification) { @@ -319,37 +305,33 @@ function Get-AbrVbrFileToTape { Section -Style NOTOCHeading6 -ExcludeFromTOC 'Advanced Settings (Advanced)' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($TBkjob.Name) advanced options." + Write-PScriboMessage "Discovered $($TBkjob.Name) advanced options." $inObj = [ordered] @{ 'Use Hardware Compression when available' = ConvertTo-TextYN $TBkjob.UseHardwareCompression } if (!$TBkjob.JobScriptOptions.PreScriptEnabled) { $inObj.add('Pre Job Script Enabled', (ConvertTo-TextYN $TBkjob.JobScriptOptions.PreScriptEnabled)) - } - elseif ($TBkjob.JobScriptOptions.PreScriptEnabled) { + } elseif ($TBkjob.JobScriptOptions.PreScriptEnabled) { $inObj.add('Run the following script before job', ($TBkjob.JobScriptOptions.PreCommand)) } if (!$TBkjob.JobScriptOptions.PostScriptEnabled) { $inObj.add('Post Job Script Enabled', (ConvertTo-TextYN $TBkjob.JobScriptOptions.PostScriptEnabled)) - } - elseif ($TBkjob.JobScriptOptions.PostScriptEnabled) { + } elseif ($TBkjob.JobScriptOptions.PostScriptEnabled) { $inObj.add('Run the following script after job', ($TBkjob.JobScriptOptions.PostCommand)) } if ($TBkjob.JobScriptOptions.PreScriptEnabled -or $TBkjob.JobScriptOptions.PostScriptEnabled) { if ($TBkjob.JobScriptOptions.Periodicity -eq 'Days') { $FrequencyValue = $TBkjob.JobScriptOptions.Day -join ", " $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($TBkjob.JobScriptOptions.Periodicity -eq 'Cycles') { + } elseif ($TBkjob.JobScriptOptions.Periodicity -eq 'Cycles') { $FrequencyValue = "Every $($TBkjob.JobScriptOptions.Frequency) backup session" $FrequencyText = 'Run Script Every Backup Session' } $inObj.add($FrequencyText, ($FrequencyValue)) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Advanced) $($TBkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Advanced) $($TBkjob.Name) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -362,24 +344,21 @@ function Get-AbrVbrFileToTape { } $OutObj | Sort-Object -Property 'Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Advanced Settings (Advanced) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Advanced Settings (Advanced) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Options Section: $($_.Exception.Message)" } } } } } } - } - catch { - Write-PscriboMessage -IsWarning "File To Tape Job Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "File To Tape Job Configuration Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrGlobalExclusion.ps1 b/Src/Private/Get-AbrVbrGlobalExclusion.ps1 index b3b9228..22266ee 100644 --- a/Src/Private/Get-AbrVbrGlobalExclusion.ps1 +++ b/Src/Private/Get-AbrVbrGlobalExclusion.ps1 @@ -20,7 +20,7 @@ function Get-AbrVbrGlobalExclusion { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Global Exclusion settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR Global Exclusion settings information from $System." } process { @@ -29,7 +29,7 @@ function Get-AbrVbrGlobalExclusion { $VMExclusions = Get-VBRVMExclusion Section -Style Heading4 'Global Exclusions' { try { - Write-PscriboMessage "Discovering Veeam VBR Malware Detection Exclusions settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR Malware Detection Exclusions settings information from $System." Section -ExcludeFromTOC -Style Heading5 'Malware Detection Exclusions' { foreach ($MalwareDetectionExclusion in $MalwareDetectionExclusions) { $OutObj = @() @@ -53,10 +53,10 @@ function Get-AbrVbrGlobalExclusion { $OutObj | Sort-Object -Property Name | Table @TableParams } } catch { - Write-PscriboMessage -IsWarning "Malware Detection Exclusions Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Malware Detection Exclusions Section: $($_.Exception.Message)" } try { - Write-PscriboMessage "Discovering Veeam VBR VM Exclusions settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR VM Exclusions settings information from $System." Section -ExcludeFromTOC -Style Heading5 'VM Exclusions' { foreach ($VMExclusion in $VMExclusions) { $OutObj = @() @@ -80,12 +80,11 @@ function Get-AbrVbrGlobalExclusion { $OutObj | Sort-Object -Property Name | Table @TableParams } } catch { - Write-PscriboMessage -IsWarning "VM Exclusions Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "VM Exclusions Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Global Exclusions Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Global Exclusions Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrGlobalNotificationSetting.ps1 b/Src/Private/Get-AbrVbrGlobalNotificationSetting.ps1 index 5fa86b0..57aded2 100644 --- a/Src/Private/Get-AbrVbrGlobalNotificationSetting.ps1 +++ b/Src/Private/Get-AbrVbrGlobalNotificationSetting.ps1 @@ -21,7 +21,7 @@ function Get-AbrVbrGlobalNotificationSetting { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Global Notification option information from $System." + Write-PScriboMessage "Discovering Veeam VBR Global Notification option information from $System." } process { @@ -33,15 +33,15 @@ function Get-AbrVbrGlobalNotificationSetting { $OutObj = @() $inObj = [ordered] @{ 'Warn me when free disk space is below' = Switch ($GlobalNotifications.StorageSpaceThresholdEnabled) { - $true {"$($GlobalNotifications.StorageSpaceThreshold)%"} - $false {'Disabled'} - default {'Unknown'} + $true { "$($GlobalNotifications.StorageSpaceThreshold)%" } + $false { 'Disabled' } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Warn me when free disk space is below' -eq "Disabled"} | Set-Style -Style Warning -Property 'Warn me when free disk space is below' + $OutObj | Where-Object { $_.'Warn me when free disk space is below' -eq "Disabled" } | Set-Style -Style Warning -Property 'Warn me when free disk space is below' } $TableParams = @{ @@ -66,21 +66,21 @@ function Get-AbrVbrGlobalNotificationSetting { $OutObj = @() $inObj = [ordered] @{ 'Warn me when free disk space is below' = Switch ($GlobalNotifications.DatastoreSpaceThresholdEnabled) { - $true {"$($GlobalNotifications.DatastoreSpaceThreshold)%"} - $false {'Disabled'} - default {'Unknown'} + $true { "$($GlobalNotifications.DatastoreSpaceThreshold)%" } + $false { 'Disabled' } + default { 'Unknown' } } 'Skip VM processig when free disk space is below' = Switch ($GlobalNotifications.SkipVMSpaceThresholdEnabled) { - $true {"$($GlobalNotifications.SkipVMSpaceThreshold)%"} - $false {'Disabled'} - default {'Unknown'} + $true { "$($GlobalNotifications.SkipVMSpaceThreshold)%" } + $false { 'Disabled' } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Is (Warn me when free disk space is below) Enabled' -eq 'No'} | Set-Style -Style Warning -Property 'Is (Warn me when free disk space is below) Enabled' - $OutObj | Where-Object { $_.'Is (Skip VM processig when free disk space is below) Enabled' -eq 'No'} | Set-Style -Style Warning -Property 'Is (Skip VM processig when free disk space is below) Enabled' + $OutObj | Where-Object { $_.'Is (Warn me when free disk space is below) Enabled' -eq 'No' } | Set-Style -Style Warning -Property 'Is (Warn me when free disk space is below) Enabled' + $OutObj | Where-Object { $_.'Is (Skip VM processig when free disk space is below) Enabled' -eq 'No' } | Set-Style -Style Warning -Property 'Is (Skip VM processig when free disk space is below) Enabled' } $TableParams = @{ @@ -109,7 +109,7 @@ function Get-AbrVbrGlobalNotificationSetting { $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Is (Enable notification about support contract expiration) Enabled' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled' + $OutObj | Where-Object { $_.'Is (Enable notification about support contract expiration) Enabled' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled' } $TableParams = @{ @@ -157,9 +157,8 @@ function Get-AbrVbrGlobalNotificationSetting { } } } - } - catch { - Write-PscriboMessage -IsWarning "Global Notifications Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Global Notifications Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrHistorySetting.ps1 b/Src/Private/Get-AbrVbrHistorySetting.ps1 index f484d44..6a880a3 100644 --- a/Src/Private/Get-AbrVbrHistorySetting.ps1 +++ b/Src/Private/Get-AbrVbrHistorySetting.ps1 @@ -21,7 +21,7 @@ function Get-AbrVbrHistorySetting { ) begin { - Write-PscriboMessage "Discovering Veeam VBR History settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR History settings information from $System." } process { @@ -47,9 +47,8 @@ function Get-AbrVbrHistorySetting { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "History Setting Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "History Setting Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrIOControlSetting.ps1 b/Src/Private/Get-AbrVbrIOControlSetting.ps1 index 8bab1b8..47043f7 100644 --- a/Src/Private/Get-AbrVbrIOControlSetting.ps1 +++ b/Src/Private/Get-AbrVbrIOControlSetting.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrIOControlSetting { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrIOControlSetting { ) begin { - Write-PscriboMessage "Discovering Veeam VBR storage latency control settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR storage latency control settings information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.Edition -in @("EnterprisePlus","Enterprise") -and $_.Status -ne "Expired"}) { + if ($VbrLicenses | Where-Object { $_.Edition -in @("EnterprisePlus", "Enterprise") -and $_.Status -ne "Expired" }) { $StorageLatencyControls = Get-VBRStorageLatencyControlOptions if ($StorageLatencyControls) { Section -Style Heading4 'Storage Latency Control' { @@ -39,14 +39,13 @@ function Get-AbrVbrIOControlSetting { 'Enabled' = ConvertTo-TextYN $StorageLatencyControl.Enabled } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Storage Latency Control Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Storage Latency Control Section: $($_.Exception.Message)" } } if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Enabled' -like 'No'} | Set-Style -Style Warning -Property 'Enabled' + $OutObj | Where-Object { $_.'Enabled' -like 'No' } | Set-Style -Style Warning -Property 'Enabled' } $TableParams = @{ @@ -63,25 +62,24 @@ function Get-AbrVbrIOControlSetting { #---------------------------------------------------------------------------------------------# try { $StorageLatencyControls = Get-VBRAdvancedLatencyOptions - if (($VbrLicenses | Where-Object {$_.Edition -eq "EnterprisePlus"}) -and $StorageLatencyControls) { + if (($VbrLicenses | Where-Object { $_.Edition -eq "EnterprisePlus" }) -and $StorageLatencyControls) { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Per Datastore Latency Control Options' { $OutObj = @() foreach ($StorageLatencyControl in $StorageLatencyControls) { try { - $Datastores = Find-VBRViEntity -DatastoresAndVMs -ErrorAction SilentlyContinue | Where-Object {($_.type -eq "Datastore")} - $DatastoreName = ($Datastores | Where-Object {$_.Reference -eq $StorageLatencyControl.DatastoreId}).Name | Select-Object -Unique + $Datastores = Find-VBRViEntity -DatastoresAndVMs -ErrorAction SilentlyContinue | Where-Object { ($_.type -eq "Datastore") } + $DatastoreName = ($Datastores | Where-Object { $_.Reference -eq $StorageLatencyControl.DatastoreId }).Name | Select-Object -Unique $inObj = [ordered] @{ 'Datastore Name' = Switch ($DatastoreName) { - $Null {$StorageLatencyControl.DatastoreId} - default {$DatastoreName} + $Null { $StorageLatencyControl.DatastoreId } + default { $DatastoreName } } 'Latency Limit' = "$($StorageLatencyControl.LatencyLimitMs)/ms" 'Throttling IO Limit' = "$($StorageLatencyControl.ThrottlingIOLimitMs)/ms" } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Per Datastore Latency Control Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Per Datastore Latency Control Options Section: $($_.Exception.Message)" } } @@ -97,16 +95,14 @@ function Get-AbrVbrIOControlSetting { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Per Datastore Latency Control Options Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Per Datastore Latency Control Options Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Storage Latency Control Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Storage Latency Control Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrInfrastructureSummary.ps1 b/Src/Private/Get-AbrVbrInfrastructureSummary.ps1 index c86c415..befdedf 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.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrInfrastructureSummary { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Infrastructure Summary from $System." + Write-PScriboMessage "Discovering Veeam VBR Infrastructure Summary from $System." } process { @@ -41,15 +41,14 @@ function Get-AbrVbrInfrastructureSummary { try { $ServiceProviders = (Get-VBRCloudProvider).count } Catch { - Write-PscriboMessage -IsWarning "Infrastructure Service Providers Summary Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Infrastructure Service Providers Summary Section: $($_.Exception.Message)" $ServiceProviders = 0 } try { $SureBackupAGs = (Get-VBRApplicationGroup).count $SureBackupVLs = (Get-VBRVirtualLab).count - } - Catch { - Write-PscriboMessage -IsWarning "Infrastructure SureBackup Summary Section: $($_.Exception.Message)" + } Catch { + Write-PScriboMessage -IsWarning "Infrastructure SureBackup Summary Section: $($_.Exception.Message)" $SureBackupAGs = 0 $SureBackupVLs = 0 } @@ -69,9 +68,8 @@ function Get-AbrVbrInfrastructureSummary { 'Capacity Licenses (Total/Used)' = "$($CapacityLicenses.LicensedCapacityTb)TB/$($CapacityLicenses.UsedCapacityTb)TB" } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Infrastructure Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Infrastructure Summary Section: $($_.Exception.Message)" } $TableParams = @{ @@ -87,11 +85,11 @@ function Get-AbrVbrInfrastructureSummary { $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' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'BackupInfrastructure' -XField 'Category' -YField 'Value' -ChartLegendName 'Infrastructure' } catch { - Write-PscriboMessage -IsWarning "Backup Infrastructure chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Backup Infrastructure chart section: $($_.Exception.Message)" } } @@ -104,9 +102,8 @@ function Get-AbrVbrInfrastructureSummary { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Infrastructure Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Infrastructure Summary Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrInstalledLicense.ps1 b/Src/Private/Get-AbrVbrInstalledLicense.ps1 index 46ad1c9..2624ea4 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.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrInstalledLicense { ) begin { - Write-PscriboMessage "Discovering Veeam V&R License information from $System." + Write-PScriboMessage "Discovering Veeam V&R License information from $System." } process { @@ -34,22 +34,22 @@ function Get-AbrVbrInstalledLicense { $OutObj = @() try { foreach ($License in $VbrLicenses) { - Write-PscriboMessage "Discovered $($License.Edition) license." + Write-PScriboMessage "Discovered $($License.Edition) license." $inObj = [ordered] @{ 'Licensed To' = $License.LicensedTo 'Edition' = $License.Edition 'Type' = $License.Type 'Status' = $License.Status 'Expiration Date' = Switch ($License.ExpirationDate) { - "" {"--"; break} - $Null {'--'; break} - default {$License.ExpirationDate.ToLongDateString()} + "" { "--"; break } + $Null { '--'; break } + default { $License.ExpirationDate.ToLongDateString() } } 'Support Id' = $License.SupportId 'Support Expiration Date' = Switch ($License.SupportExpirationDate) { - "" {"--"; break} - $Null {'--'; break} - default {$License.SupportExpirationDate.ToLongDateString()} + "" { "--"; break } + $Null { '--'; break } + default { $License.SupportExpirationDate.ToLongDateString() } } 'Auto Update Enabled' = ConvertTo-TextYN $License.AutoUpdateEnabled 'Free Agent Instance' = ConvertTo-TextYN $License.FreeAgentInstanceConsumptionEnabled @@ -57,14 +57,13 @@ function Get-AbrVbrInstalledLicense { } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "Installed License Information $($License.LicensedTo) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Installed License Information $($License.LicensedTo) Section: $($_.Exception.Message)" } if ($HealthCheck.Infrastructure.Status) { - $OutObj | Where-Object { $_.'Status' -eq 'Expired'} | Set-Style -Style Critical -Property 'Status' - $OutObj | Where-Object { $_.'Type' -eq 'Evaluation'} | Set-Style -Style Warning -Property 'Type' + $OutObj | Where-Object { $_.'Status' -eq 'Expired' } | Set-Style -Style Critical -Property 'Status' + $OutObj | Where-Object { $_.'Type' -eq 'Evaluation' } | Set-Style -Style Warning -Property 'Type' } $TableParams = @{ @@ -85,7 +84,7 @@ function Get-AbrVbrInstalledLicense { $OutObj = @() try { foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.LicensedInstancesNumber) Instance licenses." + Write-PScriboMessage "Discovered $($Licenses.LicensedInstancesNumber) Instance licenses." $inObj = [ordered] @{ 'Instances Capacity' = $License.LicensedInstancesNumber 'Used Instances' = $License.UsedInstancesNumber @@ -94,9 +93,8 @@ function Get-AbrVbrInstalledLicense { } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "Instance $($License.LicensedTo) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Instance $($License.LicensedTo) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -109,12 +107,12 @@ function Get-AbrVbrInstalledLicense { } if ($Options.EnableCharts) { try { - $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'InstanceLicenseUsage' -XField 'Category' -YField 'Value' -ChartLegendName 'Category' } catch { - Write-PscriboMessage -IsWarning "Instance License Usage chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Instance License Usage chart section: $($_.Exception.Message)" } } if ($OutObj) { @@ -134,7 +132,7 @@ function Get-AbrVbrInstalledLicense { $OutObj = @() try { foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.Type) Instance licenses." + Write-PScriboMessage "Discovered $($Licenses.Type) Instance licenses." $inObj = [ordered] @{ 'Type' = $License.Type 'Count' = $License.Count @@ -143,9 +141,8 @@ function Get-AbrVbrInstalledLicense { } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "Per Instance Type $($License.LicensedTo) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Per Instance Type $($License.LicensedTo) Section: $($_.Exception.Message)" } $TableParams = @{ @@ -159,16 +156,14 @@ function Get-AbrVbrInstalledLicense { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Instance License Usage Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Instance License Usage Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Instance License Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Instance License Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # CPU Socket License Section # @@ -179,7 +174,7 @@ function Get-AbrVbrInstalledLicense { $OutObj = @() try { foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.LicensedSocketsNumber) CPU Socket licenses." + Write-PScriboMessage "Discovered $($Licenses.LicensedSocketsNumber) CPU Socket licenses." $inObj = [ordered] @{ 'Licensed Sockets' = $License.LicensedSocketsNumber 'Used Sockets Licenses' = $License.UsedSocketsNumber @@ -187,9 +182,8 @@ function Get-AbrVbrInstalledLicense { } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "CPU Socket License Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "CPU Socket License Section: $($_.Exception.Message)" } $TableParams = @{ @@ -202,11 +196,11 @@ function Get-AbrVbrInstalledLicense { } if ($Options.EnableCharts) { try { - $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'CPUSocketUsage' -XField 'Category' -YField 'Value' -ChartLegendName 'Category' } catch { - Write-PscriboMessage -IsWarning "CPU Socket Usage chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "CPU Socket Usage chart section: $($_.Exception.Message)" } } if ($OutObj) { @@ -218,9 +212,8 @@ function Get-AbrVbrInstalledLicense { } } } - } - catch { - Write-PscriboMessage -IsWarning "CPU Socket License Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "CPU Socket License Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Capacity License Section # @@ -231,16 +224,15 @@ function Get-AbrVbrInstalledLicense { $OutObj = @() try { foreach ($License in $Licenses) { - Write-PscriboMessage "Discovered $($Licenses.LicensedCapacityTb) Capacity 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 "Capacity License Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Capacity License Section: $($_.Exception.Message)" } $TableParams = @{ @@ -254,12 +246,12 @@ function Get-AbrVbrInstalledLicense { if ($Options.EnableCharts) { if ($Options.EnableCharts) { try { - $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'CapacityLicenseUsage' -XField 'Category' -YField 'Value' -ChartLegendName 'Category' } catch { - Write-PscriboMessage -IsWarning "Capacity License Usage chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Capacity License Usage chart section: $($_.Exception.Message)" } } } @@ -272,14 +264,12 @@ function Get-AbrVbrInstalledLicense { } } } - } - catch { - Write-PscriboMessage -IsWarning "Capacity License Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Capacity License Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "License Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "License Information Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrInventorySummary.ps1 b/Src/Private/Get-AbrVbrInventorySummary.ps1 index 22f4e67..05408de 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.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,25 +21,25 @@ function Get-AbrVbrInventorySummary { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Inventory Summary from $System." + Write-PScriboMessage "Discovering Veeam VBR Inventory Summary from $System." } process { try { $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'} + $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 if ($VbrVersion -lt 12.1) { $Shares = Get-VBRNASServer -WarningAction SilentlyContinue } else { - $FileServers = Get-VBRUnstructuredServer | Where-Object {$_.Type -eq "FileServer"} - $NASFillers = Get-VBRUnstructuredServer | Where-Object {$_.Type -eq "SANSMB"} - $FileShares = Get-VBRUnstructuredServer | Where-Object {$_.Type -eq "SMB" -or $_.Type -eq "NFS"} - $ObjectStorage = Get-VBRUnstructuredServer | Where-Object {$_.Type -eq "AzureBlobServer" -or $_.Type -eq "AmazonS3Server" -or $_.Type -eq "S3CompatibleServer"} + $FileServers = Get-VBRUnstructuredServer | Where-Object { $_.Type -eq "FileServer" } + $NASFillers = Get-VBRUnstructuredServer | Where-Object { $_.Type -eq "SANSMB" } + $FileShares = Get-VBRUnstructuredServer | Where-Object { $_.Type -eq "SMB" -or $_.Type -eq "NFS" } + $ObjectStorage = Get-VBRUnstructuredServer | Where-Object { $_.Type -eq "AzureBlobServer" -or $_.Type -eq "AmazonS3Server" -or $_.Type -eq "S3CompatibleServer" } } $inObj = [ordered] @{ 'vCenter Servers' = $vCenter.Count @@ -50,18 +50,17 @@ function Get-AbrVbrInventorySummary { } if ($VbrVersion -lt 12.1) { - $inObj.add('File Shares',$Shares.Count) + $inObj.add('File Shares', $Shares.Count) } else { - $inObj.add('File Server',$FileServers.Count) - $inObj.add('NAS Fillers',$NASFillers.Count) - $inObj.add('File Shares',$FileShares.Count) - $inObj.add('Object Storage',$ObjectStorage.Count) + $inObj.add('File Server', $FileServers.Count) + $inObj.add('NAS Fillers', $NASFillers.Count) + $inObj.add('File Shares', $FileShares.Count) + $inObj.add('Object Storage', $ObjectStorage.Count) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Inventory Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Inventory Summary Section: $($_.Exception.Message)" } $TableParams = @{ @@ -74,11 +73,11 @@ function Get-AbrVbrInventorySummary { } if ($Options.EnableCharts) { try { - $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'Inventory' -XField 'Category' -YField 'Value' -ChartLegendName 'Infrastructure' } catch { - Write-PscriboMessage -IsWarning "Inventory chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Inventory chart section: $($_.Exception.Message)" } } @@ -91,9 +90,8 @@ function Get-AbrVbrInventorySummary { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Inventory Summary Section: $($_.Exception.Message)"s + } catch { + Write-PScriboMessage -IsWarning "Inventory Summary Section: $($_.Exception.Message)"s } } end {} diff --git a/Src/Private/Get-AbrVbrKMSInfo.ps1 b/Src/Private/Get-AbrVbrKMSInfo.ps1 index 2cb508b..38671e7 100644 --- a/Src/Private/Get-AbrVbrKMSInfo.ps1 +++ b/Src/Private/Get-AbrVbrKMSInfo.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrKMSInfo { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrKMSInfo { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Key Management Server information from $System." + Write-PScriboMessage "Discovering Veeam VBR Key Management Server information from $System." } process { @@ -34,7 +34,7 @@ function Get-AbrVbrKMSInfo { $OutObj = @() foreach ($KMSServer in $KMSServers) { try { - Write-PscriboMessage "Discovered $($KMSServer.Name) KMS Server." + Write-PScriboMessage "Discovered $($KMSServer.Name) KMS Server." $inObj = [ordered] @{ 'Name' = $KMSServer.Name 'CA Certificate' = $KMSServer.CACertificate @@ -43,9 +43,8 @@ function Get-AbrVbrKMSInfo { 'Description' = ConvertTo-EmptyToFiller $KMSServer.Description } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Key Management Server $($KMSServer.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Key Management Server $($KMSServer.Name) Section: $($_.Exception.Message)" } $TableParams = @{ Name = "Key Management Server - $($KMSServer.Name)" @@ -59,9 +58,8 @@ function Get-AbrVbrKMSInfo { } } } - } - catch { - Write-PscriboMessage -IsWarning "Key Management Server Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Key Management Server Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrLocation.ps1 b/Src/Private/Get-AbrVbrLocation.ps1 index f9b4824..3e3382b 100644 --- a/Src/Private/Get-AbrVbrLocation.ps1 +++ b/Src/Private/Get-AbrVbrLocation.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrLocation { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrLocation { ) begin { - Write-PscriboMessage "Discovering Veeam VBR locations information from $System." + Write-PScriboMessage "Discovering Veeam VBR locations information from $System." } process { @@ -35,15 +35,14 @@ function Get-AbrVbrLocation { $OutObj = @() foreach ($Location in $Locations) { try { - Write-PscriboMessage "Discovered $($Location.Name) location." + Write-PScriboMessage "Discovered $($Location.Name) location." $inObj = [ordered] @{ 'Name' = $Location.Name 'id' = $Location.id } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Geographical Locations $($Location.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Geographical Locations $($Location.Name) Section: $($_.Exception.Message)" } } @@ -56,15 +55,13 @@ function Get-AbrVbrLocation { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property Name | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Geographical Locations Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Geographical Locations Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Geographical Locations Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Geographical Locations Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrMalwareDetectionOption.ps1 b/Src/Private/Get-AbrVbrMalwareDetectionOption.ps1 index 9f2d9c5..35ff4f4 100644 --- a/Src/Private/Get-AbrVbrMalwareDetectionOption.ps1 +++ b/Src/Private/Get-AbrVbrMalwareDetectionOption.ps1 @@ -5,7 +5,7 @@ function Get-AbrVbrMalwareDetectionOption { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrVbrMalwareDetectionOption { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Malware Detection Option settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR Malware Detection Option settings information from $System." } process { @@ -47,7 +47,7 @@ function Get-AbrVbrMalwareDetectionOption { $OutObj += [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Update malware definition automatically' -eq 'No'} | Set-Style -Style Warning -Property 'Update malware definition automatically' + $OutObj | Where-Object { $_.'Update malware definition automatically' -eq 'No' } | Set-Style -Style Warning -Property 'Update malware definition automatically' } $TableParams = @{ @@ -60,9 +60,8 @@ function Get-AbrVbrMalwareDetectionOption { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Malware Detection Option Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Malware Detection Option Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrManagedServer.ps1 b/Src/Private/Get-AbrVbrManagedServer.ps1 index d8bef80..1ad62f3 100644 --- a/Src/Private/Get-AbrVbrManagedServer.ps1 +++ b/Src/Private/Get-AbrVbrManagedServer.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrManagedServer { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrManagedServer { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Managed Server information from $System." + Write-PScriboMessage "Discovering Veeam VBR Managed Server information from $System." } process { @@ -32,25 +32,24 @@ function Get-AbrVbrManagedServer { $OutObj = @() foreach ($ManagedServer in $ManagedServers) { try { - Write-PscriboMessage "Discovered $($ManagedServer.Name) managed server." + Write-PScriboMessage "Discovered $($ManagedServer.Name) managed server." $inObj = [ordered] @{ 'Name' = $ManagedServer.Name 'Description' = $ManagedServer.Info.TypeDescription 'Status' = Switch ($ManagedServer.IsUnavailable) { - 'False' {'Available'} - 'True' {'Unavailable'} - default {$ManagedServer.IsUnavailable} + 'False' { 'Available' } + 'True' { 'Unavailable' } + default { $ManagedServer.IsUnavailable } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Virtualization Servers and Hosts $($ManagedServer.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Virtualization Servers and Hosts $($ManagedServer.Name) Section: $($_.Exception.Message)" } } if ($HealthCheck.Infrastructure.Status) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -64,9 +63,8 @@ function Get-AbrVbrManagedServer { $OutObj | Sort-Object -Property 'Description' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Virtualization Servers and Hosts Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Virtualization Servers and Hosts Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrNDMPInfo.ps1 b/Src/Private/Get-AbrVbrNDMPInfo.ps1 index 8c71637..7e0df26 100644 --- a/Src/Private/Get-AbrVbrNDMPInfo.ps1 +++ b/Src/Private/Get-AbrVbrNDMPInfo.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrNDMPInfo { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrNDMPInfo { ) begin { - Write-PscriboMessage "Discovering Veeam VBR NDMP Servers information from $System." + Write-PScriboMessage "Discovering Veeam VBR NDMP Servers information from $System." } process { try { - if ($VbrLicenses | Where-Object {$_.Edition -in @("EnterprisePlus","Enterprise") -and $_.Status -ne "Expired"}) { + if ($VbrLicenses | Where-Object { $_.Edition -in @("EnterprisePlus", "Enterprise") -and $_.Status -ne "Expired" }) { $NDMPObjs = Get-VBRNDMPServer if ($NDMPObjs) { Section -Style Heading3 'NDMP Servers' { @@ -34,21 +34,20 @@ function Get-AbrVbrNDMPInfo { try { foreach ($NDMPObj in $NDMPObjs) { try { - Write-PscriboMessage "Discovered $($NDMPObj.Name) NDMP Server." + Write-PScriboMessage "Discovered $($NDMPObj.Name) NDMP Server." $inObj = [ordered] @{ 'Name' = $NDMPObj.Name 'Credentials' = $NDMPObj.Credentials 'Port' = $NDMPObj.Port 'Gateway' = switch ($NDMPObj.SelectedGatewayId) { - "00000000-0000-0000-0000-000000000000" {"Automatic"} - Default {(Get-VBRServer | Where-Object {$_.Id -eq $NDMPObj.SelectedGatewayId}).Name} + "00000000-0000-0000-0000-000000000000" { "Automatic" } + Default { (Get-VBRServer | Where-Object { $_.Id -eq $NDMPObj.SelectedGatewayId }).Name } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "NDMP Servers $($NDMPObj.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "NDMP Servers $($NDMPObj.Name) Section: $($_.Exception.Message)" } } @@ -62,16 +61,14 @@ function Get-AbrVbrNDMPInfo { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "NDMP Servers Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "NDMP Servers Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "NDMP Servers Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "NDMP Servers Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrNetworkTrafficRule.ps1 b/Src/Private/Get-AbrVbrNetworkTrafficRule.ps1 index 90b63d5..4358085 100644 --- a/Src/Private/Get-AbrVbrNetworkTrafficRule.ps1 +++ b/Src/Private/Get-AbrVbrNetworkTrafficRule.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrNetworkTrafficRule { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrNetworkTrafficRule { ) begin { - Write-PscriboMessage "Discovering Veeam VBR network traffic rules settings information from $System." + Write-PScriboMessage "Discovering Veeam VBR network traffic rules settings information from $System." } process { @@ -46,7 +46,7 @@ function Get-AbrVbrNetworkTrafficRule { $OutObj = [pscustomobject]$inobj if ($HealthCheck.Infrastructure.Settings) { - $OutObj | Where-Object { $_.'Encryption Enabled' -like 'No'} | Set-Style -Style Warning -Property 'Encryption Enabled' + $OutObj | Where-Object { $_.'Encryption Enabled' -like 'No' } | Set-Style -Style Warning -Property 'Encryption Enabled' } $TableParams = @{ @@ -72,7 +72,7 @@ function Get-AbrVbrNetworkTrafficRule { $TableParams = @{ Name = "Throttling Windows - $($TrafficRule.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -80,33 +80,31 @@ function Get-AbrVbrNetworkTrafficRule { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style OFF -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style OFF -Property "Sat" - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style ON -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style ON -Property "Sat" $OutObj2 } - } - catch { - Write-PscriboMessage -IsWarning "Throttling Windows Time Period Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Throttling Windows Time Period Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Network Traffic Rules Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Network Traffic Rules Section: $($_.Exception.Message)" } #---------------------------------------------------------------------------------------------# # Preferred Networks # @@ -118,16 +116,15 @@ function Get-AbrVbrNetworkTrafficRule { $PreferedNetworks = Get-VBRPreferredNetwork foreach ($PreferedNetwork in $PreferedNetworks) { try { - Write-PscriboMessage "Discovered $($PreferedNetwork.CIDRNotation) Prefered Network." + Write-PScriboMessage "Discovered $($PreferedNetwork.CIDRNotation) Prefered Network." $inObj = [ordered] @{ 'IP Address' = $PreferedNetwork.IpAddress 'Subnet Mask' = $PreferedNetwork.SubnetMask 'CIDR Notation' = $PreferedNetwork.CIDRNotation } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Preferred Networks $($PreferedNetwork.IpAddress) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Preferred Networks $($PreferedNetwork.IpAddress) Section: $($_.Exception.Message)" } } @@ -142,15 +139,13 @@ function Get-AbrVbrNetworkTrafficRule { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Preferred Networks Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Preferred Networks Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } end {} diff --git a/Src/Private/Get-AbrVbrObjectRepository.ps1 b/Src/Private/Get-AbrVbrObjectRepository.ps1 index b05e1af..c7b8c94 100644 --- a/Src/Private/Get-AbrVbrObjectRepository.ps1 +++ b/Src/Private/Get-AbrVbrObjectRepository.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrObjectRepository { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrObjectRepository { ) begin { - Write-PscriboMessage "Discovering Veeam V&R Object Storage Repository information from $System." + Write-PScriboMessage "Discovering Veeam V&R Object Storage Repository information from $System." } process { @@ -35,41 +35,39 @@ function Get-AbrVbrObjectRepository { foreach ($ObjectRepo in $ObjectRepos) { if ($Null -ne $ObjectRepo.ConnectionType) { try { - Write-PscriboMessage "Discovered $($ObjectRepo.Name) Repository." + Write-PScriboMessage "Discovered $($ObjectRepo.Name) Repository." $inObj = [ordered] @{ 'Name' = $ObjectRepo.Name 'Type' = $ObjectRepo.Type 'Connection Type' = $ObjectRepo.ConnectionType 'Gateway Server' = Switch ($ObjectRepo.ConnectionType) { - 'Direct' {'Direct Mode'} - 'Gateway' {$ObjectRepo.GatewayServer.Name} - default {'Unknown'} + 'Direct' { 'Direct Mode' } + 'Gateway' { $ObjectRepo.GatewayServer.Name } + default { 'Unknown' } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Preferred Networks $($ObjectRepo.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Preferred Networks $($ObjectRepo.Name) Section: $($_.Exception.Message)" } } else { try { - Write-PscriboMessage "Discovered $($ObjectRepo.Name) Repository." + Write-PScriboMessage "Discovered $($ObjectRepo.Name) Repository." $inObj = [ordered] @{ 'Name' = $ObjectRepo.Name 'Type' = $ObjectRepo.Type 'Use Gateway Server' = ConvertTo-TextYN $ObjectRepo.UseGatewayServer 'Gateway Server' = Switch ($ObjectRepo.GatewayServer.Name) { - "" {"--"; break} - $Null {"--"; break} - default {$ObjectRepo.GatewayServer.Name.split(".")[0]} + "" { "--"; break } + $Null { "--"; break } + default { $ObjectRepo.GatewayServer.Name.split(".")[0] } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Preferred Networks $($ObjectRepo.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Preferred Networks $($ObjectRepo.Name) Section: $($_.Exception.Message)" } } } @@ -77,7 +75,7 @@ function Get-AbrVbrObjectRepository { if ($HealthCheck.Infrastructure.BR) { - $OutObj | Where-Object { $_.'Status' -eq 'Unavailable'} | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -eq 'Unavailable' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -102,14 +100,14 @@ function Get-AbrVbrObjectRepository { try { Section -Style NOTOCHeading4 -ExcludeFromTOC "$($ObjectRepo.Name)" { $OutObj = @() - Write-PscriboMessage "Discovered $($ObjectRepo.Name) Object Backup Repository." + Write-PScriboMessage "Discovered $($ObjectRepo.Name) Object Backup Repository." $inObj = [ordered] @{ 'Name' = ($ObjectRepo).Name 'Service Point' = ($ObjectRepo).ServicePoint - 'Type' = ($ObjectRepo).Type - 'Amazon S3 Folder' = ($ObjectRepo).AmazonS3Folder + 'Type' = ($ObjectRepo).Type + 'Amazon S3 Folder' = ($ObjectRepo).AmazonS3Folder 'Immutability Period' = $ObjectRepo.ImmutabilityPeriod - 'Immutability Enabled'= ConvertTo-TextYN $ObjectRepo.BackupImmutabilityEnabled + 'Immutability Enabled' = ConvertTo-TextYN $ObjectRepo.BackupImmutabilityEnabled 'Size Limit Enabled' = ConvertTo-TextYN ($ObjectRepo).SizeLimitEnabled 'Size Limit' = ($ObjectRepo).SizeLimit @@ -160,16 +158,14 @@ function Get-AbrVbrObjectRepository { } } } - } - catch { - Write-PscriboMessage -IsWarning "Object Storage Repository Configuration $($ObjectRepo.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Object Storage Repository Configuration $($ObjectRepo.Name) Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Object Storage Repository Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Object Storage Repository Configuration Section: $($_.Exception.Message)" } } } @@ -186,12 +182,12 @@ function Get-AbrVbrObjectRepository { try { Section -Style NOTOCHeading4 -ExcludeFromTOC "$($ObjectRepoArchive.Name)" { $OutObj = @() - Write-PscriboMessage "Discovered $($ObjectRepoArchive.Name) Backup Repository." + Write-PScriboMessage "Discovered $($ObjectRepoArchive.Name) Backup Repository." $inObj = [ordered] @{ 'Gateway Server' = Switch ($ObjectRepoArchive.GatewayServer.Name) { - "" {"Auto Selected"; break} - $Null {"Auto Selected"; break} - default {$ObjectRepoArchive.GatewayServer.Name.split(".")[0]} + "" { "Auto Selected"; break } + $Null { "Auto Selected"; break } + default { $ObjectRepoArchive.GatewayServer.Name.split(".")[0] } } 'Gateway Server Enabled' = ConvertTo-TextYN $ObjectRepoArchive.UseGatewayServer 'Immutability Enabled' = ConvertTo-TextYN $ObjectRepoArchive.BackupImmutabilityEnabled @@ -201,7 +197,7 @@ function Get-AbrVbrObjectRepository { $inObj.add('Deep Archive', (ConvertTo-TextYN $ObjectRepoArchive.UseDeepArchive)) $inObj.add('Proxy Instance Type', $ObjectRepoArchive.AmazonProxySpec.InstanceType) $inObj.add('Proxy Instance vCPU', $ObjectRepoArchive.AmazonProxySpec.InstanceType.vCPUs) - $inObj.add('Proxy Instance Memory', ([Math]::Round($ObjectRepoArchive.AmazonProxySpec.InstanceType.Memory*1MB/1GB))) + $inObj.add('Proxy Instance Memory', ([Math]::Round($ObjectRepoArchive.AmazonProxySpec.InstanceType.Memory * 1MB / 1GB))) $inObj.add('Proxy Subnet', $ObjectRepoArchive.AmazonProxySpec.Subnet) $inObj.add('Proxy Security Group', $ObjectRepoArchive.AmazonProxySpec.SecurityGroup) $inObj.add('Proxy Availability Zone', $ObjectRepoArchive.AmazonProxySpec.Subnet.AvailabilityZone) @@ -215,7 +211,7 @@ function Get-AbrVbrObjectRepository { $inObj.add('Proxy Network', $ObjectRepoArchive.AzureProxySpec.Network) $inObj.add('Proxy VM Size', $ObjectRepoArchive.AzureProxySpec.VMSize) $inObj.add('Proxy VM vCPU', $ObjectRepoArchive.AzureProxySpec.VMSize.Cores) - $inObj.add('Proxy VM Memory', ([Math]::Round($ObjectRepoArchive.AzureProxySpec.VMSize.Memory*1MB/1GB))) + $inObj.add('Proxy VM Memory', ([Math]::Round($ObjectRepoArchive.AzureProxySpec.VMSize.Memory * 1MB / 1GB))) $inObj.add('Proxy VM Max Disks', $ObjectRepoArchive.AzureProxySpec.VMSize.MaxDisks) $inObj.add('Proxy VM Location', $ObjectRepoArchive.AzureProxySpec.VMSize.Location) } @@ -234,30 +230,27 @@ function Get-AbrVbrObjectRepository { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - if (($HealthCheck.Infrastructure.BestPractice) -and ($OutObj | Where-Object { $_.'Immutability Enabled' -eq 'No'})) { + if (($HealthCheck.Infrastructure.BestPractice) -and ($OutObj | Where-Object { $_.'Immutability Enabled' -eq 'No' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { Text "Best Practice:" -Bold Text "Veeam recommend to implement Immutability where it is supported. It is done for increased security: immutability protects your data from loss as a result of attacks, malware activity or any other injurious actions." - } + } } } - } - catch { - Write-PscriboMessage -IsWarning "Archive Object Storage Repository $($ObjectRepoArchive.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Archive Object Storage Repository $($ObjectRepoArchive.Name) Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Archive Object Storage Repository Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Archive Object Storage Repository Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Object Storage Repository Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Object Storage Repository Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrPhysicalInfrastructure.ps1 b/Src/Private/Get-AbrVbrPhysicalInfrastructure.ps1 index f346476..68e5406 100644 --- a/Src/Private/Get-AbrVbrPhysicalInfrastructure.ps1 +++ b/Src/Private/Get-AbrVbrPhysicalInfrastructure.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrPhysicalInfrastructure { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrPhysicalInfrastructure { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Physical Infrastructure inventory from $System." + Write-PScriboMessage "Discovering Veeam VBR Physical Infrastructure inventory from $System." } process { try { - if (($VbrLicenses | Where-Object {$_.Status -ne "Expired"}) -and $InventObjs) { + if (($VbrLicenses | Where-Object { $_.Status -ne "Expired" }) -and $InventObjs) { Section -Style Heading3 'Physical Infrastructure' { Paragraph "The following sections detail configuration information about managed physical infrastructure." BlankLine @@ -35,7 +35,7 @@ function Get-AbrVbrPhysicalInfrastructure { $OutObj = @() foreach ($InventObj in $InventObjs) { try { - Write-PscriboMessage "Discovered $($InventObj.Name) Protection Group." + Write-PScriboMessage "Discovered $($InventObj.Name) Protection Group." $inObj = [ordered] @{ 'Name' = $InventObj.Name 'Type' = $InventObj.Type @@ -45,9 +45,8 @@ function Get-AbrVbrPhysicalInfrastructure { } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Protection Groups Summary $($InventObj.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Protection Groups Summary $($InventObj.Name) Section: $($_.Exception.Message)" } } @@ -73,10 +72,10 @@ function Get-AbrVbrPhysicalInfrastructure { if ($InventObj.Type -eq 'Custom' -and $InventObj.Container.Type -eq 'ActiveDirectory') { try { Section -Style NOTOCHeading6 -ExcludeFromTOC "$($InventObj.Name)" { - Write-PscriboMessage "Discovered $($InventObj.Name) Protection Group Setting." + Write-PScriboMessage "Discovered $($InventObj.Name) Protection Group Setting." $inObj = [ordered] @{ 'Domain' = ($InventObj).Container.Domain - 'Backup Objects' = $InventObj.Container.Entity | ForEach-Object {"Name: $(($_).Name)`r`nType: $(($_).Type)`r`nDistinguished Name: $(($_).DistinguishedName)`r`n"} + 'Backup Objects' = $InventObj.Container.Entity | ForEach-Object { "Name: $(($_).Name)`r`nType: $(($_).Type)`r`nDistinguished Name: $(($_).DistinguishedName)`r`n" } 'Exclude VM' = ConvertTo-TextYN ($InventObj).Container.ExcludeVMs 'Exclude Computers' = ConvertTo-TextYN ($InventObj).Container.ExcludeComputers 'Exclude Offline Computers' = ConvertTo-TextYN ($InventObj).Container.ExcludeOfflineComputers @@ -101,15 +100,13 @@ function Get-AbrVbrPhysicalInfrastructure { } $OutObj | Table @TableParams } + } catch { + Write-PScriboMessage -IsWarning "Protection Groups Configuration $($InventObj.Name) Section: $($_.Exception.Message)" } - catch { - Write-PscriboMessage -IsWarning "Protection Groups Configuration $($InventObj.Name) Section: $($_.Exception.Message)" - } - } - elseif ($InventObj.Type -eq 'ManuallyAdded' -and $InventObj.Container.Type -eq 'IndividualComputers') { + } elseif ($InventObj.Type -eq 'ManuallyAdded' -and $InventObj.Container.Type -eq 'IndividualComputers') { try { Section -Style NOTOCHeading6 -ExcludeFromTOC "$($InventObj.Name)" { - Write-PscriboMessage "Discovered $($InventObj.Name) Protection Group Setting." + Write-PScriboMessage "Discovered $($InventObj.Name) Protection Group Setting." $inObj = [ordered] @{ 'Deployment Options' = "Install Agent: $(ConvertTo-TextYN $InventObj.DeploymentOptions.InstallAgent)`r`nUpgrade Automatically: $(ConvertTo-TextYN $InventObj.DeploymentOptions.UpgradeAutomatically)`r`nInstall Driver: $(ConvertTo-TextYN $InventObj.DeploymentOptions.InstallDriver)`r`nReboot If Required: $(ConvertTo-TextYN $InventObj.DeploymentOptions.RebootIfRequired)" } @@ -130,32 +127,27 @@ function Get-AbrVbrPhysicalInfrastructure { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Protection Groups Configuration $($InventObj.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Protection Groups Configuration $($InventObj.Name) Section: $($_.Exception.Message)" } } - } - catch { - Write-PscriboMessage -IsWarning "Protection Groups Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Protection Groups Configuration Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Protection Groups Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Protection Groups Configuration Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Protection Groups Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Protection Groups Summary Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Physical Infrastructure Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Physical Infrastructure Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrReplFailoverPlan.ps1 b/Src/Private/Get-AbrVbrReplFailoverPlan.ps1 index a4481f9..a009288 100644 --- a/Src/Private/Get-AbrVbrReplFailoverPlan.ps1 +++ b/Src/Private/Get-AbrVbrReplFailoverPlan.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrReplFailoverPlan { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.0 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrReplFailoverPlan { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Failover Plans from $System." + Write-PScriboMessage "Discovering Veeam VBR Failover Plans from $System." } process { @@ -64,7 +64,7 @@ function Get-AbrVbrReplFailoverPlan { } $OutObj | Table @TableParams if ($HealthCheck.Replication.BestPractice) { - if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description'}) { + if ($OutObj | Where-Object { $_.'Description' -match 'Created by' -or $Null -like $_.'Description' }) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { @@ -81,27 +81,26 @@ function Get-AbrVbrReplFailoverPlan { foreach ($FailOverPlansVM in $FailOverPlan.FailoverPlanObject) { try { if ($FailOverPlan.Platform -eq 'VMWare') { - Write-PscriboMessage "Discovering $($FailOverPlan.Name) VMware VM information." + Write-PScriboMessage "Discovering $($FailOverPlan.Name) VMware VM information." $VMInfo = Find-VBRViEntity -Name $FailOverPlansVM } Else { - Write-PscriboMessage "Discovering $($FailOverPlan.Name) Hyper-V VM information." + Write-PScriboMessage "Discovering $($FailOverPlan.Name) Hyper-V VM information." $VMInfo = Find-VBRHvEntity -Name $FailOverPlansVM } if ($VMInfo) { - Write-PscriboMessage "Discovered $($VMInfo.Name) VM information." + Write-PScriboMessage "Discovered $($VMInfo.Name) VM information." } $inObj = [ordered] @{ 'VM Name' = Switch ($VMInfo.Name) { - $Null {'Unknown'} - default {$VMInfo.Name} + $Null { 'Unknown' } + default { $VMInfo.Name } } 'Boot Order' = $FailOverPlansVM.BootOrder 'Boot Delay' = $FailOverPlansVM.BootDelay } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Virtual Machines $($VMInfo.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Virtual Machines $($VMInfo.Name) Section: $($_.Exception.Message)" } } @@ -115,16 +114,14 @@ function Get-AbrVbrReplFailoverPlan { } $OutObj | Sort-Object -Property 'Job Name' | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Virtual Machines Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Virtual Machines Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Failover Plans Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Failover Plans Section: $($_.Exception.Message)" } } } diff --git a/Src/Private/Get-AbrVbrReplInfraSummary.ps1 b/Src/Private/Get-AbrVbrReplInfraSummary.ps1 index fda1d3f..8cb44e8 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.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrReplInfraSummary { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Replication Summary from $System." + Write-PScriboMessage "Discovering Veeam VBR Replication Summary from $System." } process { @@ -45,11 +45,11 @@ function Get-AbrVbrReplInfraSummary { } if ($Options.EnableCharts) { try { - $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = {$_.key}},@{ Name = 'Value'; Expression = {$_.value}} | Sort-Object -Property 'Category' + $sampleData = $inObj.GetEnumerator() | Select-Object @{ Name = 'Category'; Expression = { $_.key } }, @{ Name = 'Value'; Expression = { $_.value } } | Sort-Object -Property 'Category' $chartFileItem = Get-PieChart -SampleData $sampleData -ChartName 'ReplicationInventory' -XField 'Category' -YField 'Value' -ChartLegendName 'Infrastructure' } catch { - Write-PscriboMessage -IsWarning "Replication Inventory chart section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Replication Inventory chart section: $($_.Exception.Message)" } } @@ -62,9 +62,8 @@ function Get-AbrVbrReplInfraSummary { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Replication Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Summary Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrReplReplica.ps1 b/Src/Private/Get-AbrVbrReplReplica.ps1 index 6f208ca..0511df2 100644 --- a/Src/Private/Get-AbrVbrReplReplica.ps1 +++ b/Src/Private/Get-AbrVbrReplReplica.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrReplReplica { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.7.2 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrReplReplica { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Replicas from $System." + Write-PScriboMessage "Discovering Veeam VBR Replicas from $System." } process { @@ -97,21 +97,18 @@ function Get-AbrVbrReplReplica { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Replica $($Replica.JobName) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica $($Replica.JobName) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Replica Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Replica Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replica Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrRepljob.ps1 b/Src/Private/Get-AbrVbrRepljob.ps1 index 4939c25..651e628 100644 --- a/Src/Private/Get-AbrVbrRepljob.ps1 +++ b/Src/Private/Get-AbrVbrRepljob.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrRepljob { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.7.1 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrRepljob { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Replication jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR Replication jobs information from $System." } process { try { - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -eq 'VMware Replication' -or $_.TypeToString -eq 'Hyper-V Replication'} | Sort-Object -Property Name + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq 'VMware Replication' -or $_.TypeToString -eq 'Hyper-V Replication' } | Sort-Object -Property Name if (($Bkjobs).count -gt 0) { Section -Style Heading3 'Replication Jobs' { Paragraph "The following section provide a summary about replication jobs" @@ -34,21 +34,20 @@ function Get-AbrVbrRepljob { $OutObj = @() foreach ($Bkjob in $Bkjobs) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) replication job." + Write-PScriboMessage "Discovered $($Bkjob.Name) replication job." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString 'Status' = Switch ($Bkjob.IsScheduleEnabled) { - 'False' {'Disabled'} - 'True' {'Enabled'} + 'False' { 'Disabled' } + 'True' { 'Enabled' } } 'Latest Result' = $Bkjob.info.LatestStatus 'Last Run' = $Bkjob.FindLastSession().EndTimeUTC } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Replication Jobs $($Bkjob.Name) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Jobs $($Bkjob.Name) Section: $($_.Exception.Message)" } } @@ -60,12 +59,11 @@ function Get-AbrVbrRepljob { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $OutObj | Sort-Object -Property Name |Table @TableParams + $OutObj | Sort-Object -Property Name | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "Replication Jobs Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Replication Jobs Section: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrRepljobHyperV.ps1 b/Src/Private/Get-AbrVbrRepljobHyperV.ps1 index ae822f8..cf81229 100644 --- a/Src/Private/Get-AbrVbrRepljobHyperV.ps1 +++ b/Src/Private/Get-AbrVbrRepljobHyperV.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrRepljobHyperV { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrRepljobHyperV { ) begin { - Write-PscriboMessage "Discovering Veeam VBR Hyper-V replication jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR Hyper-V replication jobs information from $System." } process { try { - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -eq 'Hyper-V Replication'} | Sort-Object -Property Name + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq 'Hyper-V Replication' } | Sort-Object -Property Name if (($Bkjobs).count -gt 0) { Section -Style Heading3 'Hyper-V Replication Jobs Configuration' { Paragraph "The following section details the configuration about Hyper-V replication jobs." @@ -35,16 +35,15 @@ function Get-AbrVbrRepljobHyperV { try { foreach ($VMcount in $Bkjobs) { try { - Write-PscriboMessage "Discovered $($VMcount.Name) ." + Write-PScriboMessage "Discovered $($VMcount.Name) ." $inObj = [ordered] @{ 'Name' = $VMcount.Name 'Creation Time' = $VMcount.CreationTime - 'VM Count' = (Get-VBRReplica | Where-Object {$_.JobName -eq $VMcount.Name}).VMcount + 'VM Count' = (Get-VBRReplica | Where-Object { $_.JobName -eq $VMcount.Name }).VMcount } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Table: $($_.Exception.Message)" } } @@ -57,9 +56,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Section: $($_.Exception.Message)" } $OutObj = @() foreach ($Bkjob in $Bkjobs) { @@ -68,10 +66,10 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading4 -ExcludeFromTOC 'Common Information' { $OutObj = @() try { - $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -eq 'Hyper-V Replication'}).Info + $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq 'Hyper-V Replication' }).Info foreach ($CommonInfo in $CommonInfos) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) common information." + Write-PScriboMessage "Discovered $($Bkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString @@ -82,9 +80,8 @@ function Get-AbrVbrRepljobHyperV { 'Modified By' = $CommonInfo.CommonInfo.ModifiedBy.FullName } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs Common Information Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs Common Information Table: $($_.Exception.Message)" } } @@ -97,9 +94,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs Common Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs Common Information Section: $($_.Exception.Message)" } } Section -Style NOTOCHeading5 -ExcludeFromTOC 'Destination' { @@ -107,22 +103,21 @@ function Get-AbrVbrRepljobHyperV { try { foreach ($Destination in $Bkjob.HvReplicaTargetOptions) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) destination information." + Write-PScriboMessage "Discovered $($Bkjob.Name) destination information." if (!$Destination.ClusterName) { - $HostorCluster = (Find-VBRHvEntity -ErrorAction SilentlyContinue | Where-Object { $_.Reference -eq $Destination.HostReference}).Name - } else {$HostorCluster = $Destination.ClusterName} + $HostorCluster = (Find-VBRHvEntity -ErrorAction SilentlyContinue | Where-Object { $_.Reference -eq $Destination.HostReference }).Name + } else { $HostorCluster = $Destination.ClusterName } $inObj = [ordered] @{ 'Host or Cluster' = Switch ($HostorCluster) { - $Null {'Unknown'} - default {$HostorCluster} + $Null { 'Unknown' } + default { $HostorCluster } } 'Path' = $Destination.TargetFolder } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($HostorCluster) Destination Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($HostorCluster) Destination Table: $($_.Exception.Message)" } } @@ -135,9 +130,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Destination Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Destination Section: $($_.Exception.Message)" } } if ($Bkjob.HvReplicaTargetOptions.UseNetworkMapping) { @@ -146,15 +140,14 @@ function Get-AbrVbrRepljobHyperV { try { foreach ($NetMapping in $Bkjob.Options.HvNetworkMappingOptions.NetworkMapping) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) network mapping information." + Write-PScriboMessage "Discovered $($Bkjob.Name) network mapping information." $inObj = [ordered] @{ 'Source Network' = $NetMapping.SourceNetwork.NetworkName 'Target Network' = $NetMapping.TargetNetwork.NetworkName } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Network Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Network Table: $($_.Exception.Message)" } } @@ -167,9 +160,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Source Network' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Network Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Network Section: $($_.Exception.Message)" } } } @@ -180,7 +172,7 @@ function Get-AbrVbrRepljobHyperV { try { foreach ($ReIpRule in $Bkjob.Options.ReIPRulesOptions.Rules) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." + Write-PScriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." $inObj = [ordered] @{ 'Source IP Address' = $ReIpRule.Source.IPAddress 'Source Subnet Mask' = $ReIpRule.Source.SubnetMask @@ -190,9 +182,8 @@ function Get-AbrVbrRepljobHyperV { 'Target DNS Addresses' = $ReIpRule.Target.DNSAddresses } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" } } @@ -205,9 +196,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Source IP Address' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" } } } @@ -217,7 +207,7 @@ function Get-AbrVbrRepljobHyperV { try { foreach ($ReIpRule in $Bkjob.Options.ReIPRulesOptions.RulesIPv4) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." + Write-PScriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." $inObj = [ordered] @{ 'Source IP Address' = $ReIpRule.Source.IPAddress 'Source Subnet Mask' = $ReIpRule.Source.SubnetMask @@ -227,9 +217,8 @@ function Get-AbrVbrRepljobHyperV { 'Target DNS Addresses' = $ReIpRule.Target.DNSAddresses } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" } } @@ -242,9 +231,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Source IP Address' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" } } } @@ -253,8 +241,8 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading5 -ExcludeFromTOC "Virtual Machines" { $OutObj = @() try { - foreach ($OBJ in ($Bkjob.GetHvOijs() | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "Exclude"} )) { - Write-PscriboMessage "Discovered $($OBJ.Object.Name) object to replicate." + foreach ($OBJ in ($Bkjob.GetHvOijs() | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "Exclude" } )) { + Write-PScriboMessage "Discovered $($OBJ.Object.Name) object to replicate." $inObj = [ordered] @{ 'Name' = $OBJ.Object.Name 'Resource Type' = $OBJ.Object.Type @@ -274,29 +262,27 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Virtual Machine Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Virtual Machine Section: $($_.Exception.Message)" } } } Section -Style NOTOCHeading5 -ExcludeFromTOC 'Job Settings' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." if ($Bkjob.BackupStorageOptions.RetentionType -eq "Days") { $RetainString = 'Restore Point To Keep' $Retains = $Bkjob.BackupStorageOptions.RetainDaysToKeep - } - elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { + } elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { $RetainString = 'Retain Cycles' $Retains = $Bkjob.BackupStorageOptions.RetainCycles } $inObj = [ordered] @{ 'Repository for replica metadata' = 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} + '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 } } 'Replica Name Suffix' = $Bkjob.Options.HvReplicaTargetOptions.ReplicaNameSuffix $RetainString = $Retains @@ -316,7 +302,7 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($Bkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $Bkjob.Options.GenerationPolicy.EnableRechek 'SLCG Schedule Type' = $Bkjob.Options.GenerationPolicy.RecheckScheduleKind @@ -353,9 +339,8 @@ function Get-AbrVbrRepljobHyperV { } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Maintenance) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Maintenance) Section: $($_.Exception.Message)" } } } @@ -363,38 +348,38 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Traffic)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) traffic options." + Write-PScriboMessage "Discovered $($Bkjob.Name) traffic options." $inObj = [ordered] @{ 'Inline Data Deduplication' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.EnableDeduplication 'Exclude Swap Files Block' = ConvertTo-TextYN $Bkjob.HvSourceOptions.ExcludeSwapFile 'Exclude Deleted Files Block' = ConvertTo-TextYN $Bkjob.HvSourceOptions.DirtyBlocksNullingEnabled 'Compression Level' = Switch ($Bkjob.Options.BackupStorageOptions.CompressionLevel) { - 0 {'NONE'} - -1 {'AUTO'} - 4 {'DEDUPE_friendly'} - 5 {'OPTIMAL (Default)'} - 6 {'High'} - 9 {'EXTREME'} + 0 { 'NONE' } + -1 { 'AUTO' } + 4 { 'DEDUPE_friendly' } + 5 { 'OPTIMAL (Default)' } + 6 { 'High' } + 9 { 'EXTREME' } } 'Storage optimization' = Switch ($Bkjob.Options.BackupStorageOptions.StgBlockSize) { - 'KbBlockSize1024' {'Local target'} - 'KbBlockSize512' {'LAN target'} - 'KbBlockSize256' {'WAN target'} - 'KbBlockSize4096' {'Local target (large blocks)'} - default {$Bkjob.Options.BackupStorageOptions.StgBlockSize} + 'KbBlockSize1024' { 'Local target' } + 'KbBlockSize512' { 'LAN target' } + 'KbBlockSize256' { 'WAN target' } + 'KbBlockSize4096' { 'Local target (large blocks)' } + default { $Bkjob.Options.BackupStorageOptions.StgBlockSize } } 'Enabled Backup File Encryption' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled 'Encryption Key' = Switch ($Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled) { - $false {'None'} - default {(Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description} + $false { 'None' } + default { (Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Jobs.BestPractice) { - $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' - $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Swap Files Block' - $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' + $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' + $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Swap Files Block' + $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' } $TableParams = @{ @@ -407,18 +392,17 @@ function Get-AbrVbrRepljobHyperV { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' }) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Backup and replica data is a high potential source of vulnerability. To secure data stored in backups and replicas, use Veeam Backup & Replication inbuilt encryption to protect data in backups" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Traffic) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Traffic) Section: $($_.Exception.Message)" } } } @@ -426,7 +410,7 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) notification options." + Write-PScriboMessage "Discovered $($Bkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SnmpNotification 'Send Email Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SendEmailNotification2AdditionalAddresses @@ -453,9 +437,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Notification) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Notification) Section: $($_.Exception.Message)" } } } @@ -463,7 +446,7 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Hyper-V)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Hyper-V options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Hyper-V options." $inObj = [ordered] @{ 'Enable Hyper-V Guest Quiescence' = ConvertTo-TextYN $Bkjob.Options.HvSourceOptions.EnableHvQuiescence 'Crash Consistent Backup' = ConvertTo-TextYN $Bkjob.Options.HvSourceOptions.CanDoCrashConsistent @@ -481,9 +464,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Hyper-V) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Hyper-V) Section: $($_.Exception.Message)" } } } @@ -491,7 +473,7 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Integration)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Integration options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Integration options." $inObj = [ordered] @{ 'Enable Backup from Storage Snapshots' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.UseSanSnapshots 'Limit processed VM count per Storage Snapshot' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.MultipleStorageSnapshotEnabled @@ -510,9 +492,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Integration) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Integration) Section: $($_.Exception.Message)" } } } @@ -523,12 +504,11 @@ function Get-AbrVbrRepljobHyperV { if ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Days') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Days -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { + } elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($Bkjob.Name) script options." + Write-PScriboMessage "Discovered $($Bkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $Bkjob.Options.JobScriptCommand.PreScriptEnabled 'Run Script Before the Job' = $Bkjob.Options.JobScriptCommand.PreScriptCommandLine @@ -549,9 +529,8 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Script) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (Script) Section: $($_.Exception.Message)" } } } @@ -559,7 +538,7 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (RPO Monitor)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) rpo monitor options." + Write-PScriboMessage "Discovered $($Bkjob.Name) rpo monitor options." $inObj = [ordered] @{ 'RPO Monitor Enabled' = ConvertTo-TextYN $Bkjob.Options.RpoOptions.Enabled 'If Backup is not Copied Within' = "$($Bkjob.Options.RpoOptions.Value) $($Bkjob.Options.RpoOptions.TimeUnit)" @@ -577,46 +556,42 @@ function Get-AbrVbrRepljobHyperV { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (RPO Monitor) Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Advanced Settings (RPO Monitor) Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Settings Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Settings Section: $($_.Exception.Message)" } } try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Data Transfer' { $OutObj = @() - Write-PscriboMessage "Discovered $($Bkjob.Name) data transfer." + Write-PScriboMessage "Discovered $($Bkjob.Name) data transfer." $inObj = [ordered] @{ 'Source Proxy' = Switch (($Bkjob.GetProxy().Name).count) { - 0 {"Unknown"} - {$_ -gt 1} {"Automatic"} - default {$Bkjob.GetProxy().Name} + 0 { "Unknown" } + { $_ -gt 1 } { "Automatic" } + default { $Bkjob.GetProxy().Name } } 'Target Proxy' = Switch (($Bkjob.GetTargetProxies().Name).count) { - 0 {"Unknown"} - {$_ -gt 1} {"Automatic"} - default {$Bkjob.GetTargetProxies().Name} + 0 { "Unknown" } + { $_ -gt 1 } { "Automatic" } + default { $Bkjob.GetTargetProxies().Name } } 'Use Wan accelerator' = ConvertTo-TextYN $Bkjob.IsWanAcceleratorEnabled() } if ($Bkjob.IsWanAcceleratorEnabled()) { try { $TargetWanAccelerator = $Bkjob.GetTargetWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Data Transfer GetTargetWanAccelerator Item: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Data Transfer GetTargetWanAccelerator Item: $($_.Exception.Message)" } try { $SourceWanAccelerator = $Bkjob.GetSourceWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Data Transfer GetSourceWanAccelerator Item: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Data Transfer GetSourceWanAccelerator Item: $($_.Exception.Message)" } $inObj.add('Source Wan accelerator', $SourceWanAccelerator) $inObj.add('Target Wan accelerator', $TargetWanAccelerator) @@ -633,18 +608,17 @@ function Get-AbrVbrRepljobHyperV { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Data Transfer Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Data Transfer Section: $($_.Exception.Message)" } if ($Bkjob.Options.HvReplicaTargetOptions.InitialSeeding) { try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Seeding' { $OutObj = @() - Write-PscriboMessage "Discovered $($Bkjob.Name) seeding information." + Write-PScriboMessage "Discovered $($Bkjob.Name) seeding information." if ($Bkjob.Options.HvReplicaTargetOptions.EnableInitialPass) { $SeedRepo = $Bkjob.GetInitialRepository().Name - } else {$SeedRepo = 'Disabled'} + } else { $SeedRepo = 'Disabled' } $inObj = [ordered] @{ 'Seed from Backup Repository' = $SeedRepo 'Map Replica to Existing VM' = ConvertTo-TextYN $Bkjob.Options.HvReplicaTargetOptions.UseVmMapping @@ -662,49 +636,48 @@ function Get-AbrVbrRepljobHyperV { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Seeding Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Seeding Table: $($_.Exception.Message)" } } if ($Bkjob.VssOptions.Enabled) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Guest Processing" { $OutObj = @() try { - $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "VssChild"} + $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "VssChild" } foreach ($VSSObj in $VSSObjs) { - Write-PscriboMessage "Discovered $($Bkjob.Name) guest processing." + Write-PScriboMessage "Discovered $($Bkjob.Name) guest processing." $inObj = [ordered] @{ 'Name' = $VSSObj.Name 'Enabled' = ConvertTo-TextYN $VSSObj.VssOptions.Enabled - 'Resource Type' = ($Bkjob.GetHvOijs() | Where-Object {$_.Name -eq $VSSObj.Name -and ($_.Type -eq "Include" -or $_.Type -eq "VssChild")}).Object.Type + 'Resource Type' = ($Bkjob.GetHvOijs() | Where-Object { $_.Name -eq $VSSObj.Name -and ($_.Type -eq "Include" -or $_.Type -eq "VssChild") }).Object.Type 'Ignore Errors' = ConvertTo-TextYN $VSSObj.VssOptions.IgnoreErrors 'Guest Proxy Auto Detect' = ConvertTo-TextYN $VSSObj.VssOptions.GuestProxyAutoDetect - 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}).count) { - 0 {'None'} - Default {Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}} + 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid }).count) { + 0 { 'None' } + Default { Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid } } } 'Object Credential' = Switch ($VSSObj.VssOptions.WinCredsId.Guid) { - '00000000-0000-0000-0000-000000000000' {'Default Credential'} - default {Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid}} + '00000000-0000-0000-0000-000000000000' { 'Default Credential' } + default { Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid } } } 'Application Processing' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.ApplicationProcessingEnabled 'Transaction Logs' = Switch ($VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { - 'False' {'Process Transaction Logs'} - 'True' {'Perform Copy Only'} + 'False' { 'Process Transaction Logs' } + 'True' { 'Perform Copy Only' } } 'Use Persistent Guest Agent' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.UsePersistentGuestAgent } if ($InfoLevel.Jobs.Replication -ge 2) { if (!$VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { $TransactionLogsProcessing = Switch ($VSSObj.VssOptions.SqlBackupOptions.TransactionLogsProcessing) { - 'TruncateOnlyOnSuccessJob' {'Truncate logs'} - 'Backup' {'Backup logs periodically'} - 'NeverTruncate' {'Do not truncate logs'} + 'TruncateOnlyOnSuccessJob' { 'Truncate logs' } + 'Backup' { 'Backup logs periodically' } + 'NeverTruncate' { 'Do not truncate logs' } } $RetainLogBackups = Switch ($VSSObj.VssOptions.SqlBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups" } } $inObj.add('SQL Transaction Logs Processing', ($TransactionLogsProcessing)) $inObj.add('SQL Backup Log Every', ("$($VSSObj.VssOptions.SqlBackupOptions.BackupLogsFrequencyMin) min")) @@ -712,18 +685,18 @@ function Get-AbrVbrRepljobHyperV { } if ($VSSObj.VssOptions.OracleBackupOptions.BackupLogsEnabled -or $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { $ArchivedLogsTruncation = Switch ($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { - 'ByAge' {"Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours"} - 'BySize' {"Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB"} - default {$VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation} + 'ByAge' { "Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours" } + 'BySize' { "Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB" } + default { $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation } } $SysdbaCredsId = Switch ($VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId) { - '00000000-0000-0000-0000-000000000000' {'Guest OS Credential'} - default {(Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId}).Description} + '00000000-0000-0000-0000-000000000000' { 'Guest OS Credential' } + default { (Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId }).Description } } $RetainLogBackups = Switch ($VSSObj.VssOptions.OracleBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups" } } $inObj.add('Oracle Account Type', $VSSObj.VssOptions.OracleBackupOptions.AccountType) $inObj.add('Oracle Sysdba Creds', $SysdbaCredsId) @@ -737,24 +710,22 @@ function Get-AbrVbrRepljobHyperV { $inObj.add('File Exclusions', (ConvertTo-TextYN $VSSObj.VssOptions.GuestFSExcludeOptions.FileExcludeEnabled)) if ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'ExcludeSpecifiedFolders') { $inObj.add('Exclude the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.ExcludeList -join ',')) - } - elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { - $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList-join ',')) + } elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { + $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList -join ',')) } } if ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode -ne 'Disabled') { $ScriptingMode = Switch ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode) { - 'FailJobOnError' {'Require successfull script execution'} - 'IgnoreErrors' {'Ignore script execution failures'} - 'Disabled' {'Disable script execution'} + 'FailJobOnError' { 'Require successfull script execution' } + 'IgnoreErrors' { 'Ignore script execution failures' } + 'Disabled' { 'Disable script execution' } } $inObj.add('Scripts', (ConvertTo-TextYN $VSSObj.VssOptions.GuestScriptsOptions.IsAtLeastOneScriptSet)) $inObj.add('Scripts Mode', ($ScriptingMode)) if ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Windows Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PreScriptFilePath)) $inObj.add('Windows Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PostScriptFilePath)) - } - elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { + } elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Linux Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PreScriptFilePath)) $inObj.add('Linux Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PostScriptFilePath)) } @@ -773,9 +744,8 @@ function Get-AbrVbrRepljobHyperV { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Guest Proccessing Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Guest Proccessing Table: $($_.Exception.Message)" } } } @@ -783,20 +753,17 @@ function Get-AbrVbrRepljobHyperV { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." if ($Bkjob.ScheduleOptions.OptionsDaily.Enabled -eq "True") { $ScheduleType = "Daily" $Schedule = "Kind: $($Bkjob.ScheduleOptions.OptionsDaily.Kind),`r`nDays: $($Bkjob.ScheduleOptions.OptionsDaily.DaysSrv)" - } - elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfMonth),`r`nDay Number In Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayNumberInMonth),`r`nDay Of Week: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfWeek)" - } - elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { $ScheduleType = $Bkjob.ScheduleOptions.OptionsPeriodically.Kind $Schedule = "Full Period: $($Bkjob.ScheduleOptions.OptionsPeriodically.FullPeriod),`r`nHourly Offset: $($Bkjob.ScheduleOptions.OptionsPeriodically.HourlyOffset),`r`nUnit: $($Bkjob.ScheduleOptions.OptionsPeriodically.Unit)" - } - elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { $ScheduleType = 'Continuous' $Schedule = "Schedule Time Period" } @@ -806,8 +773,8 @@ function Get-AbrVbrRepljobHyperV { 'Backup Window' = ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled 'Shedule type' = $ScheduleType 'Shedule Options' = $Schedule - 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() - 'Latest Run' = $Bkjob.LatestRunLocal + 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() + 'Latest Run' = $Bkjob.LatestRunLocal } $OutObj = [pscustomobject]$inobj @@ -834,10 +801,9 @@ function Get-AbrVbrRepljobHyperV { $Regex = [Regex]::new("(?<=<$Day>)(.*)(?=)") if ($Bkjob.TypeToString -eq "VMware Backup Copy") { $BackupWindow = $Bkjob.ScheduleOptions.OptionsContinuous.Schedule - } else {$BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow} + } else { $BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow } $Match = $Regex.Match($BackupWindow) - if($Match.Success) - { + if ($Match.Success) { $ScheduleTimePeriod += $Match.Value } } @@ -847,7 +813,7 @@ function Get-AbrVbrRepljobHyperV { $TableParams = @{ Name = "Backup Window - $($Bkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -855,46 +821,42 @@ function Get-AbrVbrRepljobHyperV { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style ON -Property "Sat" - - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style OFF -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style ON -Property "Sat" + + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style OFF -Property "Sat" $OutObj2 } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Backup Window Time Period table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Backup Window Time Period table: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Schedule Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs $($Bkjob.Name) Schedule Table: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Document: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "Hyper-V Replication Jobs Configuration Document: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrRepljobVMware.ps1 b/Src/Private/Get-AbrVbrRepljobVMware.ps1 index aa9ee7c..0f26f58 100644 --- a/Src/Private/Get-AbrVbrRepljobVMware.ps1 +++ b/Src/Private/Get-AbrVbrRepljobVMware.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrRepljobVMware { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,12 +21,12 @@ function Get-AbrVbrRepljobVMware { ) begin { - Write-PscriboMessage "Discovering Veeam VBR VMware replication jobs information from $System." + Write-PScriboMessage "Discovering Veeam VBR VMware replication jobs information from $System." } process { try { - $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -eq 'VMware Replication'} | Sort-Object -Property Name + $Bkjobs = Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq 'VMware Replication' } | Sort-Object -Property Name if ($Bkjobs) { Section -Style Heading3 'VMware Replication Jobs Configuration' { Paragraph "The following section details the configuration abut VMware type backup jobs." @@ -35,16 +35,15 @@ function Get-AbrVbrRepljobVMware { try { foreach ($VMcount in $Bkjobs) { try { - Write-PscriboMessage "Discovered $($VMcount.Name)." + Write-PScriboMessage "Discovered $($VMcount.Name)." $inObj = [ordered] @{ 'Name' = $VMcount.Name 'Creation Time' = $VMcount.Info.CreationTimeUtc.ToLongDateString() - 'VM Count' = (Get-VBRReplica | Where-Object {$_.JobName -eq $VMcount.Name}).VMcount + 'VM Count' = (Get-VBRReplica | Where-Object { $_.JobName -eq $VMcount.Name }).VMcount } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Summary $($VMcount.Name) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Summary $($VMcount.Name) Table: $($_.Exception.Message)" } } @@ -57,9 +56,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Name' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Summary Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Summary Section: $($_.Exception.Message)" } $OutObj = @() foreach ($Bkjob in $Bkjobs) { @@ -68,10 +66,10 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Common Information' { $OutObj = @() try { - $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue | Where-object {$_.TypeToString -eq 'VMware Replication'}).Info + $CommonInfos = (Get-VBRJob -WarningAction SilentlyContinue | Where-Object { $_.TypeToString -eq 'VMware Replication' }).Info foreach ($CommonInfo in $CommonInfos) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) common information." + Write-PScriboMessage "Discovered $($Bkjob.Name) common information." $inObj = [ordered] @{ 'Name' = $Bkjob.Name 'Type' = $Bkjob.TypeToString @@ -82,9 +80,8 @@ function Get-AbrVbrRepljobVMware { 'Modified By' = $CommonInfo.CommonInfo.ModifiedBy.FullName } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs Common Information $($Bkjob.Name) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs Common Information $($Bkjob.Name) Table: $($_.Exception.Message)" } } @@ -97,9 +94,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs Common Information Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs Common Information Section: $($_.Exception.Message)" } } Section -Style NOTOCHeading5 -ExcludeFromTOC 'Destination' { @@ -107,23 +103,22 @@ function Get-AbrVbrRepljobVMware { try { foreach ($Destination in $Bkjob.ViReplicaTargetOptions) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) destination information." + Write-PScriboMessage "Discovered $($Bkjob.Name) destination information." if (!$Destination.ClusterName) { - $HostorCluster = (Find-VBRViEntity -ErrorAction SilentlyContinue | Where-Object { $_.Reference -eq $Destination.HostReference}).Name - } else {$HostorCluster = $Destination.ClusterName} + $HostorCluster = (Find-VBRViEntity -ErrorAction SilentlyContinue | Where-Object { $_.Reference -eq $Destination.HostReference }).Name + } else { $HostorCluster = $Destination.ClusterName } $inObj = [ordered] @{ 'Host or Cluster' = Switch ($HostorCluster) { - $Null {'Unknown'} - default {$HostorCluster} + $Null { 'Unknown' } + default { $HostorCluster } } 'Resources Pool' = $Destination.ReplicaTargetResourcePoolName 'VM Folder' = $Destination.ReplicaTargetVmFolderName 'Datastore' = $Destination.DatastoreName } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Destination Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Destination Table: $($_.Exception.Message)" } } @@ -136,9 +131,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs Destination Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs Destination Section: $($_.Exception.Message)" } } if ($Bkjob.ViReplicaTargetOptions.UseNetworkMapping) { @@ -147,15 +141,14 @@ function Get-AbrVbrRepljobVMware { try { foreach ($NetMapping in $Bkjob.Options.ViNetworkMappingOptions.NetworkMapping) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) network mapping information." + Write-PScriboMessage "Discovered $($Bkjob.Name) network mapping information." $inObj = [ordered] @{ 'Source Network' = $NetMapping.SourceNetwork 'Target Network' = $NetMapping.TargetNetwork } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Network Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Network Table: $($_.Exception.Message)" } } @@ -168,9 +161,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Source Network' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Network Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Network Section: $($_.Exception.Message)" } } } @@ -181,7 +173,7 @@ function Get-AbrVbrRepljobVMware { try { foreach ($ReIpRule in $Bkjob.Options.ReIPRulesOptions.Rules) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." + Write-PScriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." $inObj = [ordered] @{ 'Source IP Address' = $ReIpRule.Source.IPAddress 'Source Subnet Mask' = $ReIpRule.Source.SubnetMask @@ -191,9 +183,8 @@ function Get-AbrVbrRepljobVMware { 'Target DNS Addresses' = $ReIpRule.Target.DNSAddresses } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" } } @@ -206,9 +197,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Source IP Address' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" } } } @@ -218,7 +208,7 @@ function Get-AbrVbrRepljobVMware { try { foreach ($ReIpRule in $Bkjob.Options.ReIPRulesOptions.RulesIPv4) { try { - Write-PscriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." + Write-PScriboMessage "Discovered $($Bkjob.Name) re-ip rules $($ReIpRule.Source.IPAddress) information." $inObj = [ordered] @{ 'Source IP Address' = $ReIpRule.Source.IPAddress 'Source Subnet Mask' = $ReIpRule.Source.SubnetMask @@ -228,9 +218,8 @@ function Get-AbrVbrRepljobVMware { 'Target DNS Addresses' = $ReIpRule.Target.DNSAddresses } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Table: $($_.Exception.Message)" } } @@ -243,9 +232,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Sort-Object -Property 'Source IP Address' | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Re-IP Rules Section: $($_.Exception.Message)" } } } @@ -254,8 +242,8 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading5 -ExcludeFromTOC "Virtual Machines" { $OutObj = @() try { - foreach ($OBJ in ($Bkjob.GetViOijs() | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "Exclude"} )) { - Write-PscriboMessage "Discovered $($OBJ.Name) object to replicate." + foreach ($OBJ in ($Bkjob.GetViOijs() | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "Exclude" } )) { + Write-PScriboMessage "Discovered $($OBJ.Name) object to replicate." $inObj = [ordered] @{ 'Name' = $OBJ.Name 'Resource Type' = $OBJ.TypeDisplayName @@ -275,29 +263,27 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs Virtual Machine Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs Virtual Machine Section: $($_.Exception.Message)" } } } Section -Style NOTOCHeading5 -ExcludeFromTOC 'Job Settings' { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) storage options." + Write-PScriboMessage "Discovered $($Bkjob.Name) storage options." if ($Bkjob.BackupStorageOptions.RetentionType -eq "Days") { $RetainString = 'Restore Point To Keep' $Retains = $Bkjob.BackupStorageOptions.RetainDaysToKeep - } - elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { + } elseif ($Bkjob.BackupStorageOptions.RetentionType -eq "Cycles") { $RetainString = 'Retain Cycles' $Retains = $Bkjob.BackupStorageOptions.RetainCycles } $inObj = [ordered] @{ 'Repository for replica metadata' = 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} + '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 } } 'Replica Name Suffix' = $Bkjob.Options.ViReplicaTargetOptions.ReplicaNameSuffix $RetainString = $Retains @@ -317,7 +303,7 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Maintenance)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) maintenance options." + Write-PScriboMessage "Discovered $($Bkjob.Name) maintenance options." $inObj = [ordered] @{ 'Storage-Level Corruption Guard (SLCG)' = ConvertTo-TextYN $Bkjob.Options.GenerationPolicy.EnableRechek 'SLCG Schedule Type' = $Bkjob.Options.GenerationPolicy.RecheckScheduleKind @@ -357,9 +343,8 @@ function Get-AbrVbrRepljobVMware { } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Maintenance) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Maintenance) Table: $($_.Exception.Message)" } } } @@ -367,38 +352,38 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Traffic)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) traffic options." + Write-PScriboMessage "Discovered $($Bkjob.Name) traffic options." $inObj = [ordered] @{ 'Inline Data Deduplication' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.EnableDeduplication 'Exclude Swap Files Block' = ConvertTo-TextYN $Bkjob.ViSourceOptions.ExcludeSwapFile 'Exclude Deleted Files Block' = ConvertTo-TextYN $Bkjob.ViSourceOptions.DirtyBlocksNullingEnabled 'Compression Level' = Switch ($Bkjob.Options.BackupStorageOptions.CompressionLevel) { - 0 {'NONE'} - -1 {'AUTO'} - 4 {'DEDUPE_friendly'} - 5 {'OPTIMAL (Default)'} - 6 {'High'} - 9 {'EXTREME'} + 0 { 'NONE' } + -1 { 'AUTO' } + 4 { 'DEDUPE_friendly' } + 5 { 'OPTIMAL (Default)' } + 6 { 'High' } + 9 { 'EXTREME' } } 'Storage optimization' = Switch ($Bkjob.Options.BackupStorageOptions.StgBlockSize) { - 'KbBlockSize1024' {'Local target'} - 'KbBlockSize512' {'LAN target'} - 'KbBlockSize256' {'WAN target'} - 'KbBlockSize4096' {'Local target (large blocks)'} - default {$Bkjob.Options.BackupStorageOptions.StgBlockSize} + 'KbBlockSize1024' { 'Local target' } + 'KbBlockSize512' { 'LAN target' } + 'KbBlockSize256' { 'WAN target' } + 'KbBlockSize4096' { 'Local target (large blocks)' } + default { $Bkjob.Options.BackupStorageOptions.StgBlockSize } } 'Enabled Backup File Encryption' = ConvertTo-TextYN $Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled 'Encryption Key' = Switch ($Bkjob.Options.BackupStorageOptions.StorageEncryptionEnabled) { - $false {'None'} - default {(Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description} + $false { 'None' } + default { (Get-VBREncryptionKey | Where-Object { $_.id -eq $Bkjob.Info.PwdKeyId }).Description } } } $OutObj = [pscustomobject]$inobj if ($HealthCheck.Jobs.BestPractice) { - $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'} | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' - $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Swap Files Block' - $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No'} | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' + $OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' } | Set-Style -Style Warning -Property 'Enabled Backup File Encryption' + $OutObj | Where-Object { $_.'Exclude Swap Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Swap Files Block' + $OutObj | Where-Object { $_.'Exclude Deleted Files Block' -eq 'No' } | Set-Style -Style Warning -Property 'Exclude Deleted Files Block' } $TableParams = @{ @@ -411,18 +396,17 @@ function Get-AbrVbrRepljobVMware { } $OutObj | Table @TableParams if ($HealthCheck.Jobs.BestPractice) { - if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No'}) { + if ($OutObj | Where-Object { $_.'Enabled Backup File Encryption' -eq 'No' }) { Paragraph "Health Check:" -Bold -Underline - Blankline + BlankLine Paragraph { Text "Best Practice:" -Bold Text "Backup and replica data is a high potential source of vulnerability. To secure data stored in backups and replicas, use Veeam Backup & Replication inbuilt encryption to protect data in backups" } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Traffic) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Traffic) Table: $($_.Exception.Message)" } } } @@ -430,7 +414,7 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Notification)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) notification options." + Write-PScriboMessage "Discovered $($Bkjob.Name) notification options." $inObj = [ordered] @{ 'Send Snmp Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SnmpNotification 'Send Email Notification' = ConvertTo-TextYN $Bkjob.Options.NotificationOptions.SendEmailNotification2AdditionalAddresses @@ -457,9 +441,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Notification) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Notification) Table: $($_.Exception.Message)" } } } @@ -467,7 +450,7 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (vSphere)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) vSphere options." + Write-PScriboMessage "Discovered $($Bkjob.Name) vSphere options." $inObj = [ordered] @{ 'Enable VMware Tools Quiescence' = ConvertTo-TextYN $Bkjob.Options.ViSourceOptions.VMToolsQuiesce 'Use Change Block Tracking' = ConvertTo-TextYN $Bkjob.Options.ViSourceOptions.UseChangeTracking @@ -485,9 +468,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (vSphere) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (vSphere) Table: $($_.Exception.Message)" } } } @@ -495,7 +477,7 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (Integration)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) Integration options." + Write-PScriboMessage "Discovered $($Bkjob.Name) Integration options." $inObj = [ordered] @{ 'Enable Backup from Storage Snapshots' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.UseSanSnapshots 'Limit processed VM count per Storage Snapshot' = ConvertTo-TextYN $Bkjob.Options.SanIntegrationOptions.MultipleStorageSnapshotEnabled @@ -514,9 +496,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Integration) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Integration) Table: $($_.Exception.Message)" } } } @@ -527,12 +508,11 @@ function Get-AbrVbrRepljobVMware { if ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Days') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Days -join "," $FrequencyText = 'Run Script on the Selected Days' - } - elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { + } elseif ($Bkjob.Options.JobScriptCommand.Periodicity -eq 'Cycles') { $FrequencyValue = $Bkjob.Options.JobScriptCommand.Frequency $FrequencyText = 'Run Script Every Backup Session' } - Write-PscriboMessage "Discovered $($Bkjob.Name) script options." + Write-PScriboMessage "Discovered $($Bkjob.Name) script options." $inObj = [ordered] @{ 'Run the Following Script Before' = ConvertTo-TextYN $Bkjob.Options.JobScriptCommand.PreScriptEnabled 'Run Script Before the Job' = $Bkjob.Options.JobScriptCommand.PreScriptCommandLine @@ -553,9 +533,8 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Script) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (Script) Table: $($_.Exception.Message)" } } } @@ -563,7 +542,7 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading6 -ExcludeFromTOC "Advanced Settings (RPO Monitor)" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) rpo monitor options." + Write-PScriboMessage "Discovered $($Bkjob.Name) rpo monitor options." $inObj = [ordered] @{ 'RPO Monitor Enabled' = ConvertTo-TextYN $Bkjob.Options.RpoOptions.Enabled 'If Backup is not Copied Within' = "$($Bkjob.Options.RpoOptions.Value) $($Bkjob.Options.RpoOptions.TimeUnit)" @@ -581,31 +560,29 @@ function Get-AbrVbrRepljobVMware { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (RPO Monitor) Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Advanced Settings (RPO Monitor) Table: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Job Setting Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Job Setting Section: $($_.Exception.Message)" } } try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Data Transfer' { $OutObj = @() - Write-PscriboMessage "Discovered $($Bkjob.Name) data transfer." + Write-PScriboMessage "Discovered $($Bkjob.Name) data transfer." $inObj = [ordered] @{ 'Source Proxy' = Switch (($Bkjob.GetProxy().Name).count) { - 0 {"Unknown"} - {$_ -gt 1} {"Automatic"} - default {$Bkjob.GetProxy().Name} + 0 { "Unknown" } + { $_ -gt 1 } { "Automatic" } + default { $Bkjob.GetProxy().Name } } 'Target Proxy' = Switch (($Bkjob.GetTargetProxies().Name).count) { - 0 {"Unknown"} - {$_ -gt 1} {"Automatic"} - default {$Bkjob.GetTargetProxies().Name} + 0 { "Unknown" } + { $_ -gt 1 } { "Automatic" } + default { $Bkjob.GetTargetProxies().Name } } 'Use Wan accelerator' = ConvertTo-TextYN $Bkjob.IsWanAcceleratorEnabled() } @@ -613,15 +590,13 @@ function Get-AbrVbrRepljobVMware { if ($Bkjob.IsWanAcceleratorEnabled()) { try { $TargetWanAccelerator = $Bkjob.GetTargetWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Data Transfer GetTargetWanAccelerator Item: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Data Transfer GetTargetWanAccelerator Item: $($_.Exception.Message)" } try { $SourceWanAccelerator = $Bkjob.GetSourceWanAccelerator().Name - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Data Trsnfer GetSourceWanAccelerator Item: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Data Trsnfer GetSourceWanAccelerator Item: $($_.Exception.Message)" } $inObj.add('Source Wan accelerator', $SourceWanAccelerator) $inObj.add('Target Wan accelerator', $TargetWanAccelerator) @@ -639,18 +614,17 @@ function Get-AbrVbrRepljobVMware { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Data Trsnfer Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Data Trsnfer Section: $($_.Exception.Message)" } if ($Bkjob.Options.ViReplicaTargetOptions.InitialSeeding) { try { Section -Style NOTOCHeading5 -ExcludeFromTOC 'Seeding' { $OutObj = @() - Write-PscriboMessage "Discovered $($Bkjob.Name) seeding information." + Write-PScriboMessage "Discovered $($Bkjob.Name) seeding information." if ($Bkjob.Options.ViReplicaTargetOptions.EnableInitialPass) { $SeedRepo = $Bkjob.GetInitialRepository().Name - } else {$SeedRepo = 'Disabled'} + } else { $SeedRepo = 'Disabled' } $inObj = [ordered] @{ 'Seed from Backup Repository' = $SeedRepo 'Map Replica to Existing VM' = ConvertTo-TextYN $Bkjob.Options.ViReplicaTargetOptions.UseVmMapping @@ -668,49 +642,48 @@ function Get-AbrVbrRepljobVMware { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Seeding Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Seeding Section: $($_.Exception.Message)" } } if ($Bkjob.VssOptions.Enabled) { Section -Style NOTOCHeading5 -ExcludeFromTOC "Guest Processing" { $OutObj = @() try { - $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object {$_.Type -eq "Include" -or $_.Type -eq "VssChild"} + $VSSObjs = Get-VBRJobObject -Job $Bkjob.Name | Where-Object { $_.Type -eq "Include" -or $_.Type -eq "VssChild" } foreach ($VSSObj in $VSSObjs) { - Write-PscriboMessage "Discovered $($Bkjob.Name) guest processing." + Write-PScriboMessage "Discovered $($Bkjob.Name) guest processing." $inObj = [ordered] @{ 'Name' = $VSSObj.Name '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 + '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 - 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}).count) { - 0 {'None'} - Default {Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid}} + 'Default Credential' = Switch ((Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid }).count) { + 0 { 'None' } + Default { Get-VBRCredentials | Where-Object { $_.Id -eq $Bkjob.VssOptions.WinCredsId.Guid } } } 'Object Credential' = Switch ($VSSObj.VssOptions.WinCredsId.Guid) { - '00000000-0000-0000-0000-000000000000' {'Default Credential'} - default {Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid}} + '00000000-0000-0000-0000-000000000000' { 'Default Credential' } + default { Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.WinCredsId.Guid } } } 'Application Processing' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.ApplicationProcessingEnabled 'Transaction Logs' = Switch ($VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { - 'False' {'Process Transaction Logs'} - 'True' {'Perform Copy Only'} + 'False' { 'Process Transaction Logs' } + 'True' { 'Perform Copy Only' } } 'Use Persistent Guest Agent' = ConvertTo-TextYN $VSSObj.VssOptions.VssSnapshotOptions.UsePersistentGuestAgent } if ($InfoLevel.Jobs.Replication -ge 2) { if (!$VSSObj.VssOptions.VssSnapshotOptions.IsCopyOnly) { $TransactionLogsProcessing = Switch ($VSSObj.VssOptions.SqlBackupOptions.TransactionLogsProcessing) { - 'TruncateOnlyOnSuccessJob' {'Truncate logs'} - 'Backup' {'Backup logs periodically'} - 'NeverTruncate' {'Do not truncate logs'} + 'TruncateOnlyOnSuccessJob' { 'Truncate logs' } + 'Backup' { 'Backup logs periodically' } + 'NeverTruncate' { 'Do not truncate logs' } } $RetainLogBackups = Switch ($VSSObj.VssOptions.SqlBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.SqlBackupOptions.RetainDays) days of log backups" } } $inObj.add('SQL Transaction Logs Processing', ($TransactionLogsProcessing)) $inObj.add('SQL Backup Log Every', ("$($VSSObj.VssOptions.SqlBackupOptions.BackupLogsFrequencyMin) min")) @@ -718,18 +691,18 @@ function Get-AbrVbrRepljobVMware { } if ($VSSObj.VssOptions.OracleBackupOptions.BackupLogsEnabled -or $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { $ArchivedLogsTruncation = Switch ($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation) { - 'ByAge' {"Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours"} - 'BySize' {"Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB"} - default {$VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation} + 'ByAge' { "Delete Log Older Than $($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxAgeHours) hours" } + 'BySize' { "Delete Log Over $([Math]::Round($VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsMaxSizeMb / 1024, 0)) GB" } + default { $VSSObj.VssOptions.OracleBackupOptions.ArchivedLogsTruncation } } $SysdbaCredsId = Switch ($VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId) { - '00000000-0000-0000-0000-000000000000' {'Guest OS Credential'} - default {(Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId}).Description} + '00000000-0000-0000-0000-000000000000' { 'Guest OS Credential' } + default { (Get-VBRCredentials | Where-Object { $_.Id -eq $VSSObj.VssOptions.OracleBackupOptions.SysdbaCredsId }).Description } } $RetainLogBackups = Switch ($VSSObj.VssOptions.OracleBackupOptions.UseDbBackupRetention) { - 'True' {'Until the corresponding image-level backup is deleted'} - 'False' {"Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups"} + 'True' { 'Until the corresponding image-level backup is deleted' } + 'False' { "Keep Only Last $($VSSObj.VssOptions.OracleBackupOptions.RetainDays) days of log backups" } } $inObj.add('Oracle Account Type', $VSSObj.VssOptions.OracleBackupOptions.AccountType) $inObj.add('Oracle Sysdba Creds', $SysdbaCredsId) @@ -743,24 +716,22 @@ function Get-AbrVbrRepljobVMware { $inObj.add('File Exclusions', (ConvertTo-TextYN $VSSObj.VssOptions.GuestFSExcludeOptions.FileExcludeEnabled)) if ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'ExcludeSpecifiedFolders') { $inObj.add('Exclude the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.ExcludeList -join ',')) - } - elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { - $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList-join ',')) + } elseif ($VSSObj.VssOptions.GuestFSExcludeOptions.BackupScope -eq 'IncludeSpecifiedFolders') { + $inObj.add('Include only the following file and folders', ($VSSObj.VssOptions.GuestFSExcludeOptions.IncludeList -join ',')) } } if ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode -ne 'Disabled') { $ScriptingMode = Switch ($VSSObj.VssOptions.GuestScriptsOptions.ScriptingMode) { - 'FailJobOnError' {'Require successfull script execution'} - 'IgnoreErrors' {'Ignore script execution failures'} - 'Disabled' {'Disable script execution'} + 'FailJobOnError' { 'Require successfull script execution' } + 'IgnoreErrors' { 'Ignore script execution failures' } + 'Disabled' { 'Disable script execution' } } $inObj.add('Scripts', (ConvertTo-TextYN $VSSObj.VssOptions.GuestScriptsOptions.IsAtLeastOneScriptSet)) $inObj.add('Scripts Mode', ($ScriptingMode)) if ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Windows Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PreScriptFilePath)) $inObj.add('Windows Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.WinScriptFiles.PostScriptFilePath)) - } - elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { + } elseif ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.IsAtLeastOneScriptSet) { $inObj.add('Linux Pre-freeze script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PreScriptFilePath)) $inObj.add('Linux Post-thaw script', ($VSSObj.VssOptions.GuestScriptsOptions.LinScriptFiles.PostScriptFilePath)) } @@ -779,9 +750,8 @@ function Get-AbrVbrRepljobVMware { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Guest Processing Section: $($_.Exception.Message)"e + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Guest Processing Section: $($_.Exception.Message)"e } } } @@ -789,20 +759,17 @@ function Get-AbrVbrRepljobVMware { Section -Style NOTOCHeading5 -ExcludeFromTOC "Schedule" { $OutObj = @() try { - Write-PscriboMessage "Discovered $($Bkjob.Name) schedule options." + Write-PScriboMessage "Discovered $($Bkjob.Name) schedule options." if ($Bkjob.ScheduleOptions.OptionsDaily.Enabled -eq "True") { $ScheduleType = "Daily" $Schedule = "Kind: $($Bkjob.ScheduleOptions.OptionsDaily.Kind),`r`nDays: $($Bkjob.ScheduleOptions.OptionsDaily.DaysSrv)" - } - elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsMonthly.Enabled -eq "True") { $ScheduleType = "Monthly" $Schedule = "Day Of Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfMonth),`r`nDay Number In Month: $($Bkjob.ScheduleOptions.OptionsMonthly.DayNumberInMonth),`r`nDay Of Week: $($Bkjob.ScheduleOptions.OptionsMonthly.DayOfWeek)" - } - elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsPeriodically.Enabled -eq "True") { $ScheduleType = $Bkjob.ScheduleOptions.OptionsPeriodically.Kind $Schedule = "Full Period: $($Bkjob.ScheduleOptions.OptionsPeriodically.FullPeriod),`r`nHourly Offset: $($Bkjob.ScheduleOptions.OptionsPeriodically.HourlyOffset),`r`nUnit: $($Bkjob.ScheduleOptions.OptionsPeriodically.Unit)" - } - elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { + } elseif ($Bkjob.ScheduleOptions.OptionsContinuous.Enabled -eq "True") { $ScheduleType = 'Continuous' $Schedule = "Schedule Time Period" } @@ -812,8 +779,8 @@ function Get-AbrVbrRepljobVMware { 'Backup Window' = ConvertTo-TextYN $Bkjob.ScheduleOptions.OptionsBackupWindow.IsEnabled 'Shedule type' = $ScheduleType 'Shedule Options' = $Schedule - 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() - 'Latest Run' = $Bkjob.LatestRunLocal + 'Start Time' = $Bkjob.ScheduleOptions.OptionsDaily.TimeLocal.ToShorttimeString() + 'Latest Run' = $Bkjob.LatestRunLocal } $OutObj = [pscustomobject]$inobj @@ -841,10 +808,9 @@ function Get-AbrVbrRepljobVMware { $Regex = [Regex]::new("(?<=<$Day>)(.*)(?=)") if ($Bkjob.TypeToString -eq "VMware Backup Copy") { $BackupWindow = $Bkjob.ScheduleOptions.OptionsContinuous.Schedule - } else {$BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow} + } else { $BackupWindow = $Bkjob.ScheduleOptions.OptionsBackupWindow.BackupWindow } $Match = $Regex.Match($BackupWindow) - if($Match.Success) - { + if ($Match.Success) { $ScheduleTimePeriod += $Match.Value } } @@ -854,7 +820,7 @@ function Get-AbrVbrRepljobVMware { $TableParams = @{ Name = "Backup Window - $($Bkjob.Name)" List = $true - ColumnWidths = 6,4,3,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4 + ColumnWidths = 6, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 Key = 'H' } if ($Report.ShowTableCaptions) { @@ -862,46 +828,42 @@ function Get-AbrVbrRepljobVMware { } if ($OutObj) { $OutObj2 = Table -Hashtable $OutObj @TableParams - $OutObj2.Rows | Where-Object {$_.Sun -eq "0"} | Set-Style -Style ON -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "0"} | Set-Style -Style ON -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "0"} | Set-Style -Style ON -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "0"} | Set-Style -Style ON -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "0"} | Set-Style -Style ON -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "0"} | Set-Style -Style ON -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "0"} | Set-Style -Style ON -Property "Sat" - - $OutObj2.Rows | Where-Object {$_.Sun -eq "1"} | Set-Style -Style OFF -Property "Sun" - $OutObj2.Rows | Where-Object {$_.Mon -eq "1"} | Set-Style -Style OFF -Property "Mon" - $OutObj2.Rows | Where-Object {$_.Tue -eq "1"} | Set-Style -Style OFF -Property "Tue" - $OutObj2.Rows | Where-Object {$_.Wed -eq "1"} | Set-Style -Style OFF -Property "Wed" - $OutObj2.Rows | Where-Object {$_.Thu -eq "1"} | Set-Style -Style OFF -Property "Thu" - $OutObj2.Rows | Where-Object {$_.Fri -eq "1"} | Set-Style -Style OFF -Property "Fri" - $OutObj2.Rows | Where-Object {$_.Sat -eq "1"} | Set-Style -Style OFF -Property "Sat" + $OutObj2.Rows | Where-Object { $_.Sun -eq "0" } | Set-Style -Style ON -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "0" } | Set-Style -Style ON -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "0" } | Set-Style -Style ON -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "0" } | Set-Style -Style ON -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "0" } | Set-Style -Style ON -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "0" } | Set-Style -Style ON -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "0" } | Set-Style -Style ON -Property "Sat" + + $OutObj2.Rows | Where-Object { $_.Sun -eq "1" } | Set-Style -Style OFF -Property "Sun" + $OutObj2.Rows | Where-Object { $_.Mon -eq "1" } | Set-Style -Style OFF -Property "Mon" + $OutObj2.Rows | Where-Object { $_.Tue -eq "1" } | Set-Style -Style OFF -Property "Tue" + $OutObj2.Rows | Where-Object { $_.Wed -eq "1" } | Set-Style -Style OFF -Property "Wed" + $OutObj2.Rows | Where-Object { $_.Thu -eq "1" } | Set-Style -Style OFF -Property "Thu" + $OutObj2.Rows | Where-Object { $_.Fri -eq "1" } | Set-Style -Style OFF -Property "Fri" + $OutObj2.Rows | Where-Object { $_.Sat -eq "1" } | Set-Style -Style OFF -Property "Sat" $OutObj2 } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Backup Windows Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Backup Windows Section: $($_.Exception.Message)" } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Schedule Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs $($Bkjob.Name) Schedule Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs Configuration Section: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs Configuration Section: $($_.Exception.Message)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "VMware Replication Jobs Configuration Document: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "VMware Replication Jobs Configuration Document: $($_.Exception.Message)" } } end {} diff --git a/Src/Private/Get-AbrVbrRequiredModule.ps1 b/Src/Private/Get-AbrVbrRequiredModule.ps1 index 5b9c146..77c9a2f 100644 --- a/Src/Private/Get-AbrVbrRequiredModule.ps1 +++ b/Src/Private/Get-AbrVbrRequiredModule.ps1 @@ -5,7 +5,7 @@ function Get-AbrVbrRequiredModule { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.3 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -39,17 +39,14 @@ function Get-AbrVbrRequiredModule { try { Write-PScriboMessage "Trying to import Veeam B&R modules." $Modules | Import-Module -WarningAction SilentlyContinue - } - catch { + } catch { Write-PScriboMessage -IsWarning "Failed to load Veeam Modules" } - } - else { + } else { try { Write-PScriboMessage "No Veeam Modules found, Fallback to SnapIn." Add-PSSnapin -Name VeeamPSSnapIn -PassThru -ErrorAction Stop | Out-Null - } - catch { + } catch { Write-PScriboMessage -IsWarning "Failed to load VeeamPSSnapIn and no Modules found" } } @@ -58,27 +55,24 @@ function Get-AbrVbrRequiredModule { try { $script:VbrVersion = $Module.Version.ToString() Write-PScriboMessage "Using Veeam Powershell module version $($VbrVersion)." - } - catch { + } catch { Write-PScriboMessage -IsWarning "Failed to get Version from Module" } - } - else { + } else { try { Write-PScriboMessage "No Veeam Modules found, Fallback to SnapIn." $script:VbrVersion = (Get-PSSnapin VeeamPSSnapin -ErrorAction SilentlyContinue).PSVersion.ToString() if ($VbrVersion) { Write-PScriboMessage "Using Veeam Powershell module version $($VbrVersion)." } - } - catch { + } catch { Write-PScriboMessage -IsWarning "Failed to get Version from Module or SnapIn" } } # Check if the required version of VMware PowerCLI is installed $RequiredModule = Get-Module -ListAvailable -Name $Name $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-AbrVbrScaleOutRepository.ps1 b/Src/Private/Get-AbrVbrScaleOutRepository.ps1 index 63afa47..7359218 100644 --- a/Src/Private/Get-AbrVbrScaleOutRepository.ps1 +++ b/Src/Private/Get-AbrVbrScaleOutRepository.ps1 @@ -6,7 +6,7 @@ function Get-AbrVbrScaleOutRepository { .DESCRIPTION Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.8.4 + Version: 0.8.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrVbrScaleOutRepository { ) begin { - Write-PscriboMessage "Discovering Veeam V&R ScaleOut Backup Repository information from $System." + Write-PScriboMessage "Discovering Veeam V&R ScaleOut Backup Repository information from $System." } process { @@ -34,24 +34,23 @@ function Get-AbrVbrScaleOutRepository { $OutObj = @() try { foreach ($BackupRepo in $BackupRepos) { - Write-PscriboMessage "Discovered $($BackupRepo.Name) Repository." + Write-PScriboMessage "Discovered $($BackupRepo.Name) Repository." $inObj = [ordered] @{ 'Name' = $BackupRepo.Name 'Performance Tier' = $BackupRepo.Extent.Name 'Capacity Tier' = Switch ($BackupRepo.CapacityExtent.Repository.Name) { - $null {'Not configured'} - default {$BackupRepo.CapacityExtent.Repository.Name} + $null { 'Not configured' } + default { $BackupRepo.CapacityExtent.Repository.Name } } 'Archive Tier' = Switch ($BackupRepo.ArchiveExtent.Repository.Name) { - $null {'Not configured'} - default {$BackupRepo.ArchiveExtent.Repository.Name} + $null { 'Not configured' } + default { $BackupRepo.ArchiveExtent.Repository.Name } } } $OutObj += [pscustomobject]$inobj } - } - catch { - Write-PscriboMessage -IsWarning "ScaleOut Backup Repository Table: $($_.Exception.Message)" + } catch { + Write-PScriboMessage -IsWarning "ScaleOut Backup Repository Table: $($_.Exception.Message)" } $TableParams = @{ @@ -82,16 +81,16 @@ function Get-AbrVbrScaleOutRepository { #---------------------------------------------------------------------------------------------# Section -Style NOTOCHeading6 -ExcludeFromTOC "General Settings" { $OutObj = @() - Write-PscriboMessage "Discovered $($BackupRepo.Name) General Settings." + Write-PScriboMessage "Discovered $($BackupRepo.Name) General Settings." $inObj = [ordered] @{ - 'Placement Policy' = ($BackupRepo.PolicyType -creplace '([A-Z\W_]|\d+)(? [CmdletBinding()] Param - ( + ( [Parameter ( Position = 0, Mandatory)] - [System.Array] - $InputTimePeriod - ) + [System.Array] + $InputTimePeriod + ) $OutObj = @() $Hours24 = [ordered]@{ @@ -485,7 +481,7 @@ function Get-WindowsTimePeriod { 22 = 10 23 = 11 } - $ScheduleTimePeriod = $InputTimePeriod -split '(.{48})' | Where-Object {$_} + $ScheduleTimePeriod = $InputTimePeriod -split '(.{48})' | Where-Object { $_ } foreach ($OBJ in $Hours24.GetEnumerator()) { diff --git a/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 b/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 index 6957fe3..2da86fc 100644 --- a/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.Veeam.VBR.ps1 @@ -15,7 +15,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR #> - # Do not remove or add to these parameters + # Do not remove or add to these parameters param ( [String[]] $Target, [PSCredential] $Credential @@ -39,7 +39,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { } } } Catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } # Import Report Configuration @@ -118,7 +118,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-WanAccelerator" } Catch { - Write-PscriboMessage -IsWarning "Wan Accelerator Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Wan Accelerator Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "Wan Accelerator Diagram." { @@ -128,7 +128,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "Wan Accelerator Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Wan Accelerator Diagram Section: $($_.Exception.Message)" } } } @@ -145,7 +145,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-Repository" } Catch { - Write-PscriboMessage -IsWarning "Backup Repository Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Backup Repository Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "Backup Repository Diagram." { @@ -155,7 +155,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "Backup Repository Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Backup Repository Diagram Section: $($_.Exception.Message)" } } } @@ -167,7 +167,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-Sobr" } Catch { - Write-PscriboMessage -IsWarning "ScaleOut Backup Repository Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "ScaleOut Backup Repository Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "ScaleOut Backup Repository Diagram." { @@ -177,7 +177,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "ScaleOut Backup Repository Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "ScaleOut Backup Repository Diagram Section: $($_.Exception.Message)" } } } @@ -222,7 +222,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-Tape" } Catch { - Write-PscriboMessage -IsWarning "Tape Infrastructure Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Tape Infrastructure Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "Tape Infrastructure Diagram." { @@ -232,7 +232,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "Tape Infrastructure Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Tape Infrastructure Diagram Section: $($_.Exception.Message)" } } } @@ -262,7 +262,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { Try { $Graph = New-VeeamDiagram -Target $System -Credential $Credential -Format base64 -Direction top-to-bottom -DiagramType "Backup-to-ProtectedGroup" } Catch { - Write-PscriboMessage -IsWarning "Physical Infrastructure Diagram: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Physical Infrastructure Diagram: $($_.Exception.Message)" } if ($Graph) { Section -Style Heading3 "Physical Infrastructure Diagram." { @@ -272,7 +272,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { BlankLine } } Catch { - Write-PscriboMessage -IsWarning "Physical Infrastructure Diagram Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "Physical Infrastructure Diagram Section: $($_.Exception.Message)" } } } @@ -311,7 +311,7 @@ function Invoke-AsBuiltReport.Veeam.VBR { # Replication Section # #---------------------------------------------------------------------------------------------# if ($InfoLevel.Replication.PSObject.Properties.Value -ne 0) { - if ((Get-VBRReplica).count -gt 0 -or ((Get-VBRFailoverPlan).count -gt 0)) { + if ((Get-VBRReplica).count -gt 0 -or ((Get-VBRFailoverPlan).count -gt 0)) { Section -Style Heading2 'Replication' { Paragraph "The following section provides information about the replications managed by Veeam Server $(((Get-VBRServerSession).Server))." BlankLine @@ -331,8 +331,8 @@ function Invoke-AsBuiltReport.Veeam.VBR { # Cloud Connect Section # #---------------------------------------------------------------------------------------------# if ($InfoLevel.CloudConnect.PSObject.Properties.Value -ne 0) { - if ($VbrLicenses | Where-Object {$_.CloudConnect -ne "Disabled" -and $_.Status -ne "Expired"}) { - if ((Get-VBRCloudGateway).count -gt 0 -or ((Get-VBRCloudTenant).count -gt 0)) { + if ($VbrLicenses | Where-Object { $_.CloudConnect -ne "Disabled" -and $_.Status -ne "Expired" }) { + if ((Get-VBRCloudGateway).count -gt 0 -or ((Get-VBRCloudTenant).count -gt 0)) { Section -Style Heading2 'Cloud Connect' { Paragraph "The following section provides information about Cloud Connect components from server $(((Get-VBRServerSession).Server))." BlankLine @@ -424,6 +424,6 @@ function Invoke-AsBuiltReport.Veeam.VBR { Write-PScriboMessage "Disconecting section from $((Get-VBRServerSession).Server)" Disconnect-VBRServer } - } - #endregion foreach loop + } + #endregion foreach loop }