Langmeier Backup FAQ

Guide: Extend Langmeier Backup with VBScript

Langmeier Backup offers the possibility to create scripts to implement advanced concepts for data backup. Experienced administrators thus have the possibility to introduce very specific requirements in the area of data backup into the backup run.

Examples

  • Own user notification (as SMS, on screen, by e-mail, etc...)
  • Download current backup job from the server
  • User request (example: "Please insert another backup medium")
  • Read out and close open programs
  • Reorganize target medium (e.g. rename folder)
  • Call a web URL to execute a server function

The script editor is located under the menu Tools > Edit scripts:

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

Click on the "Script" selection field and select the empty entry there to create a new script. Use Save as... you can save this script.

You can use all VBScript commands in the script. In addition, you can use the scripting commands specially implemented for Langmeier Backup described below to automate Langmeier Backup.


Command index

The complete command index can be found in the Langmeier Backup online help, which you can call up in the program. Here is an excerpt of frequently requested functions.

Progress (variable)

Assignment of a value between 1 and 100 to the Progress variable, sets the value of the progress bar in the data backup window.

Examples

Progress = 0 'Progress bar at 0 - nothing backed up yet
Progress = 50 'Progress bar at 50 - half backed up
Progress = 100 'Progress bar at 100 - backup complete

Message (method)

Outputs a text to the user in the Langmeier Backup message window. This text is also saved in the backup log.

Parameters:

Parameter Parameter Description
Text The text of the message to the user.
[Message type] The type of this message.

Possible values:

1 = Information
2 = Warning
3 = Stop

italic = Optional parameters

Example 1:

Message "Script completed."

Example 2:

Message "Please write the data carrier with 'Backup " & Weekdayname(Weekday(now)) & "' to.", 1

Backup (method)

The "Backup" function can be used to back up a folder or a file.

Parameters:

Parameter Parameter Description
Source Source path of the desired backup
Destination Destination path of the desired backup
[Subfolders] True = Backup including subfolders (default)

False = Backup without subfolders

[Encrypted] True = Encrypted backup

False = Unencrypted backup (default)

[Compressed] True = ZIP-compressed backup files

False = Uncompressed backup files (default)

[History] True = Historized data backup

False = Normal mode (default)

[CreateFullPath] True = Creates the complete backup path, e.g. C$\folder\

False = Normal mode (default)

italic = Optional parameters

Example 1: A normal data backup where the source and destination are specified.

'Normal backup:
Backup "C:\Source", "D:\Destination"

Example 2: An encrypted data backup: The source and destination are specified here and the data is also set to be encrypted.

'Encrypted backup:
Backup "C:\Source", "D:\Destination", , True

Example 3: Encrypted backup with complete path: As in example 2, an encrypted data backup is performed here and the complete path is also backed up.

'Encrypted backup with complete path:
Backup "C:\Source", "D:\Destination", , True, , , True

Break (method)

Breaks the backup, but not the current script.

Parameters:

Parameter Parameter Description
NO PARAMETERS The break method does not require any additional parameters.

GetMediaName (function)

Returns the name of the inserted medium.

Parameters:

Parameter Parameter Description
Accessor a) The tape accessor character in the form of, for example, \\.\tape0
b) A drive identifier, e.g. C:\.

Example:

If GetMediaName ("\\.tape0") <> "Monday" Then
Message "Please insert the tape `Monday`!", 3 '3 = Stop symbol
EjectMedia
Break
End If

SendSMS (Text as String, Number As String) (function)

One option that many of our customers use is the "SendSMS" option. This option sends the customer an SMS to a cell phone at the end of a backup. If the recipient is not in Switzerland, the international area code must be entered.

Firewall: under certain circumstances, a missing entry in the Windows firewall can prevent the text message from being sent. In this case, an error message appears and the script cannot be executed successfully. Please enable the Langmeier Backup program in your firewall for outgoing network traffic - then it will work.

Parameters:

Parameter Parameter Description
Text The text message to be sent to the recipient via SMS.
Number The recipient's cell phone number.

Example:

'Sends a text message to the backup administrator:
SendSMS
"Backup completed.", "004179512xxxx"

'Sends a text message to the backup administrator -
'the message contains the value specified under "Target", as well as
'the number of errors that occurred, as well as the number of
'successfully backed up files:

SendSMS Term("The backup to is complete. Error: Backed up: ", Destination, Errors, Counter), "0049xxxxxxxxxxxx"

Counter (variable)

Indicates how many files were backed up. This value appears in the feedback to the user after the backup process. This value is also specified in the backup log.

Example:

'Starts the command line script "databackup.cmd" from SAP to back up the
'database from SAP. The backup target is the backup target
'that is set in the backup task is used as the backup destination (Destination).
'The command line script returns the number of backed up
'files.

CountOfFiles = Shell("%appdata%\SAP\databackup.cmd /dest=" & Destination, 0)

'The counter of the backed up files is now increased by the
'number returned by the script:
Counter = Counter + lCountOfFiles

Destination (variable)

Returns or overwrites the destination folder preset in the backup element of the script.

Note: You can use the "Destination" variable to create a script that backs up something specific to a destination location that can be defined in the backup task. You program in the script how the specific item is backed up and what it is.

Example:

'Backs up the installation folder "SAP R3" to the backup folder set in the script:
Backup "C:\SAP-R3", Destination

Source (variable)

Returns the source preset in the backup element of the script, or overwrites this source. If the script name (e.g. @SendSMS) is under the source, the script name is returned.

Note: You can use the "Destination" variable to create a script that backs up something specific to a destination that can be defined in the backup task. You program in the script how the specific destination is backed up and what it is. With the opposite variable "Source" you have the option of letting the Langmeier backup user determine the source location that you retrieve in the script.

Example:

Source = "C:\"

Save script

After you have written/created a script, save it. The options "Save" and "Save as" can be found below the script editor.

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

Click on"Save as" to give your script a name:

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

The scripts are saved in the following folder:

C:\ProgramData\Langmeier Software\Scripts

Under older operating systems (Windows XP, Windows Server 2003):

C:\Documents and Settings\ALL Users\Application Data\Langmeier Software\Scripts

Add script to the backup task

You can add all scripts you have saved to the backup task in the main window of Langmeier Backup under"Backup" -"Add":

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

After you have selected your script, the script name appears with a preceding "@" in the backup task, here "@SMS". The script is executed in the backup run as soon as you click on "Backup" - "Start".

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

By double-clicking on the inserted script, in this case "@SMS", you can define the destination path (which you can call up in the script using "Destination" ):

Zielpfad angeben, welches das Skript verwenden soll. Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

Sequence: Note the sequence in the backup job! If a script is to be executed at the end of a backup, then the script must also be inserted at the end. Langmeier Backup processes the scripts in the order in which they are in the backup job. If the script is a function that is to be called at the beginning or after a specific folder path, then the script must be inserted in the correct line accordingly.

Alternative scripting options

You can also add a self-created VBScript to a job in a different way. Go to "Options" and then to "Settings for this job". Here you will find options that are executed "Before backup" and options that are executed "After backup". Add your VBScript to the desired location. Please note that the Langmeier Backup functions described above, such as SendSMS or Backup, are not available with this method. However, you can use this method to call any batch scripts or any compiled exe files.

Dies ist ein Tutorial, wie Sie in Langmeier Backup Business und Langmeier Backup Server eigene VBScripts erstellen, um nach Ihren Vorstellungen in den Datensicherungsvorgang einzugreifen.

The information in this article is available in the following products:

  1. Langmeier Backup Business
  2. Langmeier Backup Server
  3. Langmeier Backup V-flex

Langmeier Backup

Backup for Windows

  Buy now   Try it for free

Backup Software For Windows

about the author
Founder and CEO of Langmeier Software


I don't want to complicate anything. I don't want to develop the ultimate business software. I don't want to be listed in a top technology list. Because that's not what business applications are about. It's about making sure your data is seamlessly protected. And it's about making sure everything runs smoothly while you retain full control and can focus on growing your business. Simplicity and reliability are my guiding principles and inspire me every day.
 

Look it up further: Langmeier Backup, VB-Script, Backup

Related articles
Which type of backup is the best choice for my data?
This is how important data backup is in real life
The advantages and disadvantages of the different Windows file systems


Post a comment here...

This article covers the topics:
Langmeier Backup VBS
VBScript
Backup software with VBScript
VBS data backup