Public/Get-MSPBackupSchedule.ps1

Function Get-MSPBackupSchedule {
    <#
        .SYNOPSIS
            List existing schedules.
        .DESCRIPTION
            List existing schedules. Produces a table with columns in this order:
                ID Unique schedule identifier
                ACTV Is schedule active or not
                NAME Schedule name
                TIME Time backup will fire at
                DAYS Days backup will fire on
                DSRC Datasources to backup
                PRESID Pre-backup script ID
                POSTSID Post-backup script ID
 
            Schedule ID (first column) could further be used to modify or remove that specific schedule.
        .INPUTS
            None
        .OUTPUTS
            None
        .EXAMPLE
            Get-MSBBackupSchedule
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
    #>

    [CmdletBinding()]
    [OutputType('System.String')]
    Param()
    Begin {
        Write-Verbose ('{0}:: Function started' -f $MyInvocation.MyCommand)
        $stdOutTempFile = [System.IO.Path]::GetTempFileName()
        $stdErrTempFile = [System.IO.Path]::GetTempFileName()
    }
    Process {
        Write-Verbose ('{0}:: Getting status' -f $MyInvocation.MyCommand)
        $Schedule = & $Script:CmdPath -machine-readable control.schedule.list -no-header -delimiter ';'
        If ($null -ne $Schedule) {
            $Schedule = $Schedule.Split(";")
            [array]$Hash += $(New-CustomPSObject "ID", "Active", "Name", "Time", "Day", "Datasource", "PreBackupScriptId", "PostBackupScriptId" "$($Schedule[0])", "$($Schedule[1])", "$($Schedule[2])", "$($Schedule[3])", "$($Schedule[4])", "$($Schedule[5])", "$($Schedule[6])", "$($Schedule[7])")
        } Else {
            $Hash = $null
        }
    }
    End {
        Write-Verbose ('{0}:: Function ended' -f $MyInvocation.MyCommand)
        Return $Hash
    }
}