Public/Add-MSPBackupSchedule.ps1
Function Add-MSPBackupSchedule { <# .SYNOPSIS Create new schedule. .DESCRIPTION Create new schedule. .PARAMETER Name Name of the schedule, non-empty. .PARAMETER Active Determines whether schedule is active. Possible values are 0 (not active) or 1 (active). Default value is 1. .PARAMETER Datasource Datasources to start scheduled backup for, separated by comma. Possible values are Exchange, FileSystem, MySql, NetworkShares, Oracle, SystemState, VMware, VssHyperV, VssMsSql, VssSharePoint and All. Default value is All. .PARAMETER Day Days when schedule is active, separated by comma. Possible values are Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday and All. Default value is All. .PARAMETER PostBackupAction ID of post-backup script. All available scripts can be viewed with Get-MSPBackupScript .PARAMETER PreBackupAction ID of pre-backup script. All available scripts can be viewed with Get-MSPBackupScript .PARAMETER Time Schedule time. Must be in format hh:mm. Default value is 00:00. .INPUTS None .OUTPUTS None .EXAMPLE Add-MSPBackupSchedule .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding(SupportsShouldProcess = $true)] [OutputType('System.String')] Param( [Parameter(Mandatory = $true)] [String]$Name, [bool]$Active = $true, [String[]]$Datasource = "All", [String[]]$Day = "All", [Int]$PostBackupAction, [Int]$PreBackupAction, [datetime]$Time = "00:00" ) 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) $Status = & $Script:CmdPath -machine-readable control.schedule.add } End { Write-Verbose ('{0}:: Function ended' -f $MyInvocation.MyCommand) Return $Status } } |