This is an archive version of the document. To get the most up-to-date information, see the current version.

New-VBRJobScriptOptions

Short Description

Creates new job script options.

Applies to

Platform: VMware, Hyper-V

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

Syntax

New-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 creates the VBRJobScriptOptions object that contains pre-job and post-job script settings for backup jobs and for replication jobs. You can use this object later to apply these settings to a job.

Parameters

Parameter

Description

Required

Position

Accept
Pipeline
Input

Accept
Wildcard
Characters

PreScriptEnabled

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

Use the PreCommand parameter to set the path to the script.

False

Named

False

False

PreCommand

Specifies the path to the pre-job script.

False

Named

False

False

PostScriptEnabled

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

Use the PostCommand parameter to set the path to the script.

False

Named

False

False

PostCommand

Specifies the path to the post-job script.

False

Named

False

False

Periodicity

Specifies the script run mode: after a set number of job runs (Cycles) or on set days (Days).

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

False

Named

False

False

Day

Used to set value for the Periodicity parameter (the Days mode).

Specifies the days of week when the script will run.

Default: Saturday

False

Named

False

False

Frequency

Used to set value for the Periodicity parameter (the Cycles mode).

The number of job runs after which the script must run.

Default: 1 backup session

False

Named

False

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

VBRJobScriptOptions

Example

This command configures script settings with the following options:

  • A script runs before job and after job.
  • Scripts run on Mondays.

$scriptoptions = New-VBRJobScriptOptions -PreScriptEnabled -PreCommand "C:\scripts\pre-script.bat" -PostScriptEnabled -PostCommand "C:\scripts\pre-script.bat" -Periodicity Day -Day Monday