Src/Private/Get-AbrVbrGlobalExclusion.ps1

function Get-AbrVbrGlobalExclusion {
    <#
    .SYNOPSIS
    Used by As Built Report to returns Global Exclusion settings configured on Veeam Backup & Replication..
    .DESCRIPTION
        Documents the configuration of Veeam VBR in Word/HTML/Text formats using PScribo.
    .NOTES
        Version: 0.8.3
        Author: Jonathan Colon
        Twitter: @jcolonfzenpr
        Github: rebelinux
        Credits: Iain Brighton (@iainbrighton) - PScribo module
 
    .LINK
        https://github.com/AsBuiltReport/AsBuiltReport.Veeam.VBR
    #>

    [CmdletBinding()]
    param (

    )

    begin {
        Write-PscriboMessage "Discovering Veeam VBR Global Exclusion settings information from $System."
    }

    process {
        try {
            $MalwareDetectionExclusions = Get-VBRMalwareDetectionExclusion
            $VMExclusions = Get-VBRVMExclusion
            Section -Style Heading4 'Global Exclusions' {
                try {
                    Write-PscriboMessage "Discovering Veeam VBR Malware Detection Exclusions settings information from $System."
                    Section -ExcludeFromTOC -Style Heading5 'Malware Detection Exclusions' {
                        foreach ($MalwareDetectionExclusion in $MalwareDetectionExclusions) {
                            $OutObj = @()

                            $inObj = [ordered] @{
                                'Name' = $MalwareDetectionExclusion.Name
                                'Platform' = $MalwareDetectionExclusion.Platform
                                'Note' = ConvertTo-EmptyToFiller $MalwareDetectionExclusion.Note
                            }
                            $OutObj += [pscustomobject]$inobj
                        }

                        $TableParams = @{
                            Name = "Malware Detection Exclusions - $VeeamBackupServer"
                            List = $false
                            ColumnWidths = 33, 33, 34
                        }
                        if ($Report.ShowTableCaptions) {
                            $TableParams['Caption'] = "- $($TableParams.Name)"
                        }
                        $OutObj | Sort-Object -Property Name | Table @TableParams
                    }
                } catch {
                    Write-PscriboMessage -IsWarning "Malware Detection Exclusions Section: $($_.Exception.Message)"
                }
                try {
                    Write-PscriboMessage "Discovering Veeam VBR VM Exclusions settings information from $System."
                    Section -ExcludeFromTOC -Style Heading5 'VM Exclusions' {
                        foreach ($VMExclusion in $VMExclusions) {
                            $OutObj = @()

                            $inObj = [ordered] @{
                                'Name' = $VMExclusion.Name
                                'Platform' = $VMExclusion.Platform
                                'Note' = ConvertTo-EmptyToFiller $VMExclusion.Note
                            }
                            $OutObj += [pscustomobject]$inobj
                        }

                        $TableParams = @{
                            Name = "VM Exclusions - $VeeamBackupServer"
                            List = $false
                            ColumnWidths = 33, 33, 34
                        }
                        if ($Report.ShowTableCaptions) {
                            $TableParams['Caption'] = "- $($TableParams.Name)"
                        }
                        $OutObj | Sort-Object -Property Name | Table @TableParams
                    }
                } catch {
                    Write-PscriboMessage -IsWarning "VM Exclusions Section: $($_.Exception.Message)"
                }
            }
        }
        catch {
            Write-PscriboMessage -IsWarning "Global Exclusions Section: $($_.Exception.Message)"
        }
    }
    end {}

}