Set-VBRJobScriptOptions
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>] |
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 | Accept |
---|---|---|---|---|---|
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:
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.
- Run Get-VBRJob to get the backup job that you want to modify. Save the result to the $job variable.
- Cast the backup job to the VBRComputerBackupJob type. Use the [Veeam.Backup.PowerShell.Infos.VBRComputerBackupJob]$ComputerBackupJob value.
- Get the ScriptOptions object. Save the result to the $script variable.
- Cast the $script variable to the VBRJobScriptOptions type. Use the [Veeam.Backup.PowerShell.Infos.VBRJobScriptOptions]$JobScriptOptions value. Save the result to the $script variable.
- 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