Public/Get-MSPBackupArchivingRule.ps1

Function Get-MSPBackupArchivingRule {
    <#
        .SYNOPSIS
            List existing archiving rules.
        .DESCRIPTION
            List existing archiving rules. Produces a table with columns in this order:
            ID Unique archiving rule identifier
            ACTV Is rule active or not
            NAME Archiving rule name
            DSRC Datasources to archive
            TIME Time archiving will fire at
            MONTHS Months archiving will fire in
            MDAYS Days of month archiving will fire on
            WEEKS Weeks archiving will fire on
            WDAYS Days of week archiving will fire on
 
            Rule ID (first column) could further be used to modify or remove that specific rule.
        .INPUTS
            None
        .OUTPUTS
            None
        .EXAMPLE
            Get-MSPBackupArchivingRule
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
    #>

    [CmdletBinding()]
    [OutputType('System.String')]
    Param()
    Begin {
        Write-Verbose ('{0}:: Function started' -f $MyInvocation.MyCommand)
    }
    Process {
        Write-Verbose ('{0}:: Getting status' -f $MyInvocation.MyCommand)
        $ArchivingList = & $Script:CmdPath -machine-readable control.archiving.list -no-header -delimiter ';'
        If ($Null -ne $ArchivingList) {
            $ArchivingList = $ArchivingList.Split(";")
            [array]$Hash += $(New-CustomPSObject "Id", "Active", "Name", "DataSource", "Time", "Months", "DaysOfMonth", "Weeks", "DaysOfWeek"`
                    "$($ArchivingList[0])", "$($ArchivingList[1])", "$($ArchivingList[2])", "$($ArchivingList[3])", "$($ArchivingList[4])", "$($ArchivingList[5])", "$($ArchivingList[6])", "$($ArchivingList[7])", "$($ArchivingList[8])")
        } ElseIf ($ArchivingList -eq "No archiving rules found.") {
            $Hash = $ArchivingList
        } Else {
            $Hash = $null
        }
    }
    End {
        Write-Verbose ('{0}:: Function ended' -f $MyInvocation.MyCommand)
        Return $Hash
    }
}