Set-VBRJobScriptOptions

In this article

    Short Description

    Modifies job script options.

    Applies to

    Product Edition: Community, Standard, Enterprise, Enterprise Plus, Veeam Universal License

    Syntax

    Set-VBRJobScriptOptions -JobScriptOptions <VBRJobScriptOptions> [-PreScriptEnabled] [-PreCommand <string>][-PostScriptEnabled] [-PostCommand <string>]
    [-Day <DayOfWeek[]> {Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday}] [-Periodicity <VBRPeriodicityType> {Cycles | Days}]
    [-Frequency <uint32>][<CommonParameters>]

    Detailed Description

    This cmdlet modifies pre-job and post-job script settings for backup jobs and for replication jobs.

    To modify settings, enter the necessary parameters with new values. The parameters that you omit will remain unchanged.

    Parameters

    Parameter

    Description

    Required

    Position

    Accept
    Pipeline
    Input

    Accept
    Wildcard
    Characters

    JobScriptOptions

    Specifies the script options that you want to modify

    Accepts the VBRJobScriptOptions type.

    True

    Named

    False

     

    PreScriptEnabled

    Indicates that you want to run a script before the job.

    False

    Named

    False

     

    PreCommand

    For the PreScriptEnabled parameter.

    Specifies the path to the pre-job script.

    False

    Named

    False

     

    PostScriptEnabled

    Indicates that you want to run a script after the job.

    False

    Named

    False

     

    PostCommand

    For the PostScriptEnabled parameter.

    Specifies the path to the post-job script.

    False

    Named

    False

     

    Periodicity

    Specifies the script run schedule:

    • Cycles: to run scripts after the specified number of backup sessions.
    • Days: to run scripts on the selected days.

    Use the Day and the Frequency parameters to set the values.

    False

    Named

    False

     

    Day

    For the Days option.

    Specifies the days of the week when the script must run.

    False

    Named

    False

     

    Frequency

    For the Cycles option.

    Specifies the number of backup sessions after which the script must run.

    False

    Named

    False

     

    <CommonParameters>

    This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About CommonParameters section of Microsoft Docs.

    Return Type

    Example

    This example shows how to modify the script schedule with the following settings: Veeam Backup & Replication will run the scripts after 15 backup sessions.

    1. Run Get-VBRJob to get the backup job that you want to modify. Save the result to the $job variable.
    2. Cast the backup job to the VBRComputerBackupJob type. Use the [Veeam.Backup.PowerShell.Infos.VBRComputerBackupJob]$ComputerBackupJob value.
    3. Get the ScriptOptions object. Save the result to the $script variable.
    4. Cast the $script variable to the VBRJobScriptOptions type. Use the [Veeam.Backup.PowerShell.Infos.VBRJobScriptOptions]$JobScriptOptions value. Save the result to the $script variable.
    5. Run Set-VBRJobScriptOptions with the $script variable. Set the Days value for the Periodicity parameter to run the script on Thursdays.

    $job = Get-VBRJob -Name "BackupJob"

    [Veeam.Backup.PowerShell.Infos.VBRComputerBackupJob]$ComputerBackupJob = $job

    $script = $ComputerBackupJob.ScriptOptions

    [Veeam.Backup.PowerShell.Infos.VBRJobScriptOptions]$JobScriptOptions = $script

    Set-VBRJobScriptOptions -JobScriptOptions $script -Periodicity Days -Day Thursday

    Related Commands

    Get-VBRJob

    I want to report a typo

    There is a misspelling right here:

     

    I want to let the Veeam Documentation Team know about that.