Main Page > Browse Categories > Scripts > Show All |
Scripts |
Scripts |
E-MAIL Script: Sends E-Mail Notification After Running a Profile |
This is a Visual Basic script which sends an e-mail notification after a profile run. You can install this script by following the 5 easy steps below:
- Save the ViceVersa PRO E-Mail Script to your ViceVersa "GlobalScripts" folder, under the ViceVersa PRO 2 installation folder (usually 'C:\Program Files\ViceVersa PRO2\GlobalScripts'). If you do not have the GlobalScripts folder, you need to update to the latest version of ViceVersa PRO 2.
- Open the script with NotePad.
- Edit the 5 variables at the beginning of the script USERNAME, PASSWORD, FROM_EMAIL, TO_EMAIL , SMTP_EMAIL_SERVER
- Save the script.
- Activate the option "Run custom scripts after execution" in the advanced profile settings for all the ViceVersa PRO profiles you want to receive an e-mail for.
Notes:
- By default the script will send an email only if an error occurs. You can change this default behavior by setting the variable SEND_EMAIL_ONLY_IFERROR to FALSE. Then the script will always send an e-mail at the end of a profile execution.
- You need ViceVersa PRO 2 Build 2011 or newer for this script to work.
The following is an example of an e-mail sent by the script.
Result: OK
Profile: My Documents - backup
Exit Code: 0
Source: C:\Documents and Settings\User\My Documents\ | C:\Documents and Settings\User\Desktop\
Target: \\nas\winXP-ibm\My Documents\ | \\nas\winXP-ibm\Desktop\
User: Romeo
Computer Name: IBM-LAPTOP
Backup (Mirror Source to Target)
- Run Summary -
- Added Files - Source: 0 (0) - Target: 163 (16.73MB)
- Updated Files - Source: 0 (0) - Target: 11 (8.02MB)
- Deleted Files - Source: 0 (0) - Target: 0 (0)
- Added Subfolders - Source: 0 - Target: 14
- Deleted Subfolders - Source: 0 - Target: 0
- Archive Information -
- Files Added to Archive - Source: 0 (0) - Target: 10 (7.30MB)
- Files Deleted from Archive - Source: 0 (0) - Target: 2 (8.04KB)
- Final Status -
- Total Files - Source: 2,323 (1.98GB) - Target: 2,323 (1.98GB)
- Excluded Files - Source: 0 (0) - Target: 0 (0)
- Matched Files - Source: 2,323 (1.98GB) - Target: 2,323 (1.98GB)
- Single Files - Source: 0 (0) - Target: 0 (0)
- Newer Files - Source: 0 (0) - Target: 0 (0)
- Older Files - Source: 0 (0) - Target: 0 (0)
- Total Subfolders - Source: 224 - Target: 224
- Excluded Subfolders - Source: 0 - Target: 0
- Matched Subfolders - Source: 224 - Target: 224
- Single Subfolders - Source: 0 - Target: 0
Global and Local Scripts in ViceVersa PRO |
Since Version 2, Build 2011, ViceVersa PRO supports local and global scripts. Scripts can be setup to run before and/or after a profile execution.
Typically scripts before profile execution are run to prepare the computer environment. For example, mapping a network drive or connecting to a network resource. Instead, scripts after profile execution are run to disconnect from the network or to report, e.g. via e-mail, the results of a synchronization or a backup.
Scripts can be Visual Basic scripts (*.vbs), batch files (*.bat, *.cmd) or Java scripts (*.js)
Scripts can be global (a global script is run for all profiles) or local (a local script is only run for one profile).
Global scripts must be located in the "GlobalScripts" folder in the ViceVersa PRO installation folder, usually 'c:\program files\ViceVersa PRO2\GlobalScripts'
They must be called global_start.ext (global_start is the global script to run when a profile starts) or global_end.ext (global_end is the global script to run when a profile ends). .ext can be one of the supported extensions, that is .vbs, .js, .bat or .cmd
If you need to define multiple start scripts, the first script must be called 'global_start.ext', the second one 'global_start_1.ext', the third one 'global_start_2.ext' and so on, up to a max of 9. Same mechanism for the global end scripts: the first must be called 'global_end.ext', the second one 'global_end_1.ext', the third one 'global_end_2.ext' and so on, up to a max of 9.
Once you have created and placed your global scripts in the GlobalScripts folder, you will need to activate the option "Run custom scripts before comparison" and/or "Run custom scripts after execution" in the profile settings for the profiles you wish to run the scripts for. If you do not activate these profile options, the profile will not run the global scripts before and/or after execution.
Local scripts are run only for a specific profile. Differently from global scripts, local scripts must be located in the same folder as the ViceVersa profile file (.fsf file) and they must be called 'profilename_start.ext' for the script to run before execution, or 'profilename_end.ext' for the script to run after exection; profilename is the name of you profile, which you want to run the local script for. .ext can be one of the supported extensions, that is .vbs, .js, .bat or .cmd
Also for running local scripts, you will need to activate one or both the options "Run custom scripts before comparison" and "Run custom scripts after execution" in the profile settings for the profiles you wish to run the local scripts for.
S.M.A.R.T. Script: Checks Drive Health Before Running a Profile |
Self-Monitoring, Analysis, and Reporting Technology, or S.M.A.R.T., is a monitoring system for computer hard disks to detect and report on various indicators of reliability, in the hope of anticipating failures. More information.
The batch file downloadable on this page can be setup to run BEFORE a ViceVersa profile and if the S.M.A.R.T. check reports an issue with the computer hard disk's health, it will abort profile execution. This prevents files from being corrupted.
How to install:
- Download the file smart.zip
- Inside the smart.zip file, open and read the file install.txt which contains the installation instructions.
- Once installed, the output of the S.M.A.R.T. check will be included in the ViceVersa profile log (if a log file for the profile has been setup)
Script Output |
Script output is redirected to the ViceVersa profile log (if a log file for the profile has been setup). You are able to check the script output by looking at the ViceVersa profile log.
Script Return Codes |
If any of the scripts that run before profile execution return an exit code different from 0, the execution is canceled and the ViceVersa profile does not run.
Script Variables |
Scripts have access to some ViceVersa variables by means of Environment Variables. ViceVersa PRO makes the following variables available.
ViceVersa PRO 2 Build 2011 (or newer):
VV_PROFILE_NAME = The name of the ViceVersa profile
VV_PROFILE_PATH = The path of the ViceVersa profile
VV_SOURCE_DISK = The disk where the source folder is (e.g. c:, d:)
VV_TARGET_DISK = The disk where the target folder is (e.g. c:, d:)
VV_EXIT_CODE = The ViceVersa exit code (only for scripts running AFTER execution)
VV_SOURCE_FOLDER = The profile source folder
VV_TARGET_FOLDER = The profile target folder
VV_INCLUDE_SUBFOLDERS_FLAGS = Subfolders inclusion flag
VV_COMPARISON_TYPE = Comparison Type (0=Size and Timestamp) (1=CRC) (2=Both)
VV_EXECUTION_METHOD = Execution Method (0= None) (1=Synchronization) (2=Backup (Mirror Source to Target)) (3=Replication (Augment Target)) (4=Replication (Refresh Target)) (5=Replication (Update Target)) (6=Consolidation)
VV_LOG_FILE = Log File
VV_SOURCE_ARCHIVE_FOLDER = Source Archive Folder VV_TARGET_ARCHIVE_FOLDER = Target Archive Folder
ViceVersa PRO 2 Build 2014 (or newer):
In addition to the above variables, ViceVersa PRO 2 Build 2014 (or newer) also supports the following variables.
VV_EXIT_CODE_DESC = The textual description of the exit code
VV_EXECUTION_METHOD_DESC = Execution Method Description
VV_RUN_SUMMARY = A summary of the files copied or deleted.
VV_FINAL_STATUS_SUMMARY = The final status summary of all the files in source and target
VV_CONFLICT_SUMMARY = A list of the conflict files found during synchronization (max. 10 are listed)
ViceVersa PRO 2 Build 2015 (or newer):
In addition to the above variables, ViceVersa PRO 2 Build 2015 (or newer) also supports the following variables.
VV_RUN_START_TIME = Run Start Time
VV_RUN_END_TIME = Run End Time
*************************************************
The following is an example of how to get the value of these Environment Variables in a VBscript:
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.Environment("PROCESS").Item("VV_SOURCE_FOLDER")
WScript.Echo WshShell.Environment("PROCESS").Item("VV_TARGET_FOLDER")
WScript.Echo WshShell.Environment("PROCESS").Item("VV_LOG_FILE")
WScript.Echo WshShell.Environment("PROCESS").Item("VV_EXIT_CODE")
In a BAT file, Environment Variables can be referred to by using %%, for example:
%VV_PROFILE_NAME%
%VV_EXIT_CODE%
Using Global Scripts in ViceVersa PRO |
ViceVersa PRO 2 Build 2011 (or newer) supports Global Scripts.
Global Scripts run before and/or after profile execution.
Global Scripts can be Visual Basic scripts (*.vbs), Batch Files (*.bat, *.cmd) or Java Scripts (*.js).
Global Scripts must be located in the "GlobalScripts" folder under the ViceVersa PRO installation folder; usually 'c:\program files\ViceVersa PRO2\GlobalScripts'.
The script global_start.ext runs before a profile starts (.ext can be one of the supported extensions, i.e. .vbs, .bat, .cmd or .js)
The script global_end.ext runs after a profile ends (.ext can be one of the supported extensions, i.e. .vbs, .bat, .cmd or .js)
Once you have created the global script(s) in the GlobalScripts folder, you need to activate the option "Run custom scripts before comparison" and/or "Run custom scripts after execution" in the profile settings, for the profiles you want to run the scripts for.