The Xopero Pre/Post scripts are written in PowerShell and can be launched before or after the backup is created.
Creating the script
Xopero users can create their own scripts, that can be used during the backup process. Each script consists two files::
- PS1 - a PowerShell script,
- XML - backup set configuration file.
Both files for each script should be copied into Script folder in Xopero installation location, for example: C:\Program Files(x86)\Xopero\Script.
A PowerShell script should have a PS1 extension and it can be launched before the backup is created (PRE script) or after the backup is finished (POST script). Pre scripts are mostly used to prepare data for being backed up. Post scripts can be then used to delete temporary files that were created by pre script for the time of backup.
Each of the PowerShell scripts must contain a backup_path parameter which indicates the location where files to backup are stored.
|More information about PowerShell scripts can be found here: https://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx|
To use a PowerShell script in Xopero, each PS1 file needs corresponding XML, where all the script information is stored, such as name of the script shown in application, its location and other parameters required to run the script.
The XML file's content has to be restricted in <script> tag, which has two parameters:
- name - the name of the script which will be displayed in application,
- file - path to the PowerShell script.
Each of user's parameter have to be written as a <param /> tag with parameters:
- name - name of the parameter, the same name preceded with $ tag is used in the PowerShell script,
- description - name of the parameter displayed in the application,
- help - description of the parameter, that is displayed in the application when you click that parameter,
- value - default value of the parameter.
Some sample pre and post scripts can be found using below attachments:
- clean_backup_tmp.zip - pre script, creates an archive of selected folder, then backs it up,
- compress_db.zip - post script, deletes temporary files in given path.
Creating a Backup set
In order to create a backup set that uses pre and post scripts, you need to open Xopero and run the Backup set wizard by clicking on New backup set button in My backup sets tab.
In the Backup set wizard mark Advanced copy and select Pre/Post Scripts from dropdown list. Don’t forget to define the backup set name.
Next, you need to select scripts from the dropdown list, that will be run before/after backup is created and fill required fields.
Restore a Pre/Post Script Backup
In order to restore data that has been previously backed up by Pre/Post backup set, you need to open Xopero application, then go to Restoring tab. All the files that have been been backed up, will be in location given by backup_path parameter.
|In order to restore selected version of the database right click on its name and from context menu select Show file versions.|
In the displayed file tree, you need to navigate to proper location and then check the filed next to the files, you want to restore. When you click Restore selected, a settings window will be displayed, where you need to select destination and choose what the application shall do, if a file with the same name is present in that location.