Langmeier Backup FAQ

Guide: Extend Langmeier Backup with VBScript

Langmeier Backup empowers you to create custom scripts, enabling advanced data backup strategies tailored to your specific requirements. This feature is especially valuable for experienced administrators who wish to implement unique workflows or automation within their data backup processes.

Examples of what you can achieve with scripting:

  • Custom user notifications (via SMS, on-screen messages, email, etc.)
  • Download the latest backup job from a server
  • User prompts (e.g., “Please insert another backup medium”)
  • Detect and close open programs before backup
  • Reorganize the target medium (e.g., rename folders)
  • Trigger a web URL to execute a server-side function

The Script Editor can be accessed via the menu: Tools > Edit Scripts:

Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.

To create a new script, click on the “Script” selection field and choose the empty entry. Use “Save as...” to store your script.

You may use all VBScript commands within your script. Additionally, Langmeier Backup provides special scripting commands (detailed below) to automate Langmeier Backup even further.


Command Index

The complete command index is available in the Langmeier Backup online help, accessible directly from the program. Below, you will find a selection of the most frequently used functions.

Progress (variable)

Assigning a value between 1 and 100 to the Progress variable sets 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 message to the user in the Langmeier Backup message window. This message is also saved in the backup log.

Parameters:

Parameter Description
Text The message text to display to the user.
[Message type] The type of 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 allows you to back up a folder or file.

Parameters:

Parameter Description
Source Source path of the data to back up.
Destination Destination path for the backup.
[Subfolders] True = Include subfolders (default)
False = Exclude 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 standard backup specifying source and destination.

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

Example 2: An encrypted backup:

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

Example 3: Encrypted backup with complete path:

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

Break (method)

The Break method interrupts the backup process, but does not terminate the current script.

Parameters:

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

GetMediaName (function)

Returns the name of the inserted medium.

Parameters:

Parameter Description
Accessor a) The tape accessor character, e.g., \\.\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)

Many of our customers use the SendSMS function to send an SMS notification to a mobile phone at the end of a backup. If the recipient is outside Switzerland, please include the international area code.

Firewall: In some cases, a missing entry in the Windows firewall may prevent the SMS from being sent. If this occurs, an error message will appear and the script will not execute successfully. Please ensure that Langmeier Backup is allowed for outgoing network traffic in your firewall settings.

Parameters:

Parameter Description
Text The message text to be sent via SMS.
Number The recipient’s mobile 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",
' the number of errors, and 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 is shown to the user after the backup process and is also recorded in the backup log.

Example:

' Starts the command line script "databackup.cmd" from SAP to back up the
' database from SAP. The backup target 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 set in the backup element of the script.

Note: You can use the Destination variable to create a script that backs up specific data to a destination defined in the backup task. You control in the script what is backed up and how.

Example:

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

Source (variable)

Returns or overwrites the source set in the backup element of the script. 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 specific data to a destination defined in the backup task. With the Source variable, you can allow the Langmeier Backup user to specify the source location, which you can then retrieve in the script.

Example:

Source = "C:\"

Save Script

After you have written your script, save it. The options Save and Save as are located below the script editor.

Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.

Click on “Save as” to assign a name to your script:

Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.

Scripts are saved in the following folder:

C:\ProgramData\Langmeier Software\Scripts

On 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 any saved script to a backup task in the main window of Langmeier Backup under “Backup”“Add”:

Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.
Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.

Once you have selected your script, its name will appear in the backup task, prefixed with “@” (e.g., @SMS). The script will be executed during the backup run as soon as you click “Backup” – “Start”.

Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.

By double-clicking the inserted script (e.g., @SMS), you can define the destination path, which you can reference in your script using the Destination variable:

Specify the target path for the script. Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.
Sequence: Please pay attention to the order of scripts in the backup job! If a script should run at the end of a backup, it must be placed at the end. Langmeier Backup processes scripts in the order they appear in the backup job. If a script is to be executed at the beginning or after a specific folder, insert it accordingly.

Alternative Scripting Options

You can also add a custom VBScript to a job in another way. Go to “Options” and then “Settings for this job”. Here, you will find options to execute scripts “Before backup” and “After backup”. Add your VBScript at the desired point. Please note: Langmeier Backup-specific functions such as SendSMS or Backup are not available with this method. However, you can use this approach to call any batch scripts or compiled .exe files.

Tutorial: How to create custom VBScripts in Langmeier Backup Business and Server to customize your backup process.

The information in this article applies to 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:
VBScript
Backup software with VBScript
VBS data backup
Langmeier Backup Script