Prescripts and postscripts

You can use custom prescripts and postscripts as part of your data protection operations. These scripts enable automation either before your data protection job or after. For example, you might include a script that automatically notifies you of data protection job failures or warnings. Before you set up your prescripts and postscripts, you should understand some of the requirements for creating these scripts.

Supported script types

The following type of scripts are supported:
  • Batch files
  • PowerShell scripts
  • Perl scripts

Script path location

All prescripts and postscripts that are run as part of SnapCenter operations, on nonvirtualized and on virtualized storage systems, are executed on the SnapCenter Server. Therefore, the scripts must be located on the SnapCenter Server and the path you specify must reflect that location. If the SnapCenter Server host is in a HA configuration, you must specify a script that is accessible from both NLB nodes.

Where to specify scripts

Scripts are specified in backup policies. When a backup job is started, the policy automatically associates the script with the resources being backed up.

When you create a backup policy, the wizards in some plug-ins provide separate fields to specify prescripts and postscripts. Other wizards only provide a single field for both.

To specify multiple scripts, press Enter after each script path to list each script on a separate line. Semicolons (;) are not allowed. You can specify multiple prescripts and multiple postscripts. A single script can be coded as both a prescript and a postscript and can call other scripts.

When scripts are executed

Scripts are executed according to the value set for BACKUP_PHASE.

Environment variables passed to scripts

You can use the following environment variables in scripts.

Environment variable Description
BACKUP_NAME Name of the backup.

Variable passed in postscripts only.

BACKUP_DATE Date of the backup, in the format yyyymmdd

Variable passed in postscripts only.

BACKUP_TIME Time of the backup, in the format hhmmss

Variable passed in postscripts only.

BACKUP_PHASE The phase of the backup in which you want the script to run.


Variable passed in prescripts and postscripts.

STORAGE_SNAPSHOTS The number of storage snapshots in the backup.

Variable passed in postscripts only.

STORAGE_SNAPSHOT.# One of the defined storage snapshots, in the following format:

Variable passed in postscripts only.

VIRTUAL_MACHINES The number of VMs in the backup.

Variable passed in prescripts and postscripts.

VIRTUAL_MACHINE.# One of the defined virtual machines, in the following format:
<VM name>|<VM UUID>|
<power-state>|<VM snapshot>|

power-state has the values POWERED_ON, POWERED_OFF, or SUSPENDED

VM snapshot has the values true or false

Variable passed in prescripts and postscripts.

Script timeouts

The timeout for backup scripts is 15 minutes and cannot be modified.