Langmeier Backup FAQ

Guide: Extend Langmeier Backup with VBScript

Langmeier Backup provides the ability to create scripts to implement advanced backup concepts. Experienced administrators thus have the opportunity to incorporate very specific data backup requirements into the backup run.

Examples:

  • own user notification (as SMS, on screen, by mail, etc…)
  • Download current backup job from server
  • User prompt (example: “Please  insert other backup media“)
  • Read open programs and close them
  • Reorganize target medium (e.g. rename folder)
  • Call a web URL to perform a server function

 

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

This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to interfere with the backup process as you see fit.

Click on the "Script" selection box and select the empty entry there to create a new script. Using Save As... you can save this script.

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

 


 

command index

The complete command index can be found in Langmeier Backup's online help, which can be accessed from within the program. Here is an excerpt of frequently requested functions.

 

Progress (Variable)

Assigns 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 set to 0 - nothing saved yet
Progress = 50 'Progress bar at 50 - half backed up
Progress = 100 'Progress bar at 100 - backup complete

 

Message (method)

Puts out a text to the user in the Langmeier Backup s message window. This text is additionally stored in the backup log.

Parameters:  

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 disk with 'backup" & Weekdayname(Weekday(now)) & "' an.", 1 

 

Backup (method)

Using the „Backup“ function, a folder, or file can be backed up.

Parameters:  

parameter Description
Source  Source path of the desired backup
Target  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 = Historicized backup

False = Normal mode (default)

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

False = Normal mode (default)

italic = optional parameters 

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

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

 

Example 2: An encrypted backup: here the source and destination are specified, plus set to encrypt the data.

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

 

Example 3: Encrypted backup with complete path: Here, as in Example 2, an encrypted backup is performed and, in addition, the complete path is 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 Description
NO PARAMETERS The break method takes no additional parameters.

 

GetMediaName (function)

Returns the name of the inserted media.

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 icon
    EjectMedia
  Break
End If

 

 

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

An option that many of our customers use is the “SendSMS” option. This option sends the customer an SMS to a mobile phone at the end of a backup. If the recipient is not in Switzerland, then the international dialing code must be provided.

Firewall: under certain circumstances, a missing entry in the Windows firewall can prevent the sending of the text message. In this case, an error message will appear 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 Description
Text The text message to be sent to the recipient via SMS.
 Number The recipient's mobile phone number.

Example:

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

'Sends a short message to the backup administrator -
'the message contains the value specified under "Destination", as well as
'the number of errors encountered, as well as the number of
'successfully backed up files:

SendSMS Term("Backup to is complete. Error: Saved: ", Destination, Errors, Counter),"0049xxxxxxxxxx"
  

 

Counter (variable)

Indicates how many files were backed up. This value appears in the feedback to the user after the backup operation. In addition, this value is also specified in the backup log.

Example:

'Starts the command line script "databackup.cmd" from SAP to backup the
'database from SAP. The backup destination,
'that is set in the backup job is used (destination).
'From the command line script, the number of backed up
'files is returned.

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

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

 

Destination (variable)

Returns or overwrites the destination folder preset in the script's save element.

Note: You can use the Destination variable to create a script that backs up something specific to a destination location definable in the backup job. How the specific is backed up, and what it is, you program into the script.

Example:

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

 

Source (variable)

Returns or overwrites the source preset in the script's save element. If the script name (for example, @SendSMS) is under the source, then the script name is returned.

Note: You can use the Destination variable to create a script that backs up something specific to a destination location definable in the backup job. How the specific is backed up, and what it is, you program into the script. 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:\"

 

 

SaveScript

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

This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to interfere with the backup process as you see fit.

Click on "Save As" you can give your script a name:

This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to interfere with the backup process as you see fit.

The scripts will be stored 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 backup job

Any scripts you have saved can be added to the backup job in the main Langmeier Backup window under "Backup" - "Add

 This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to interfere with the backup process as you see fit.

 This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to intervene in the backup process as you see fit.

After you have selected your script, the script name will appear with a prefix „@“ in the backup job, here "@SMS". The script will be executed as soon as you click on "Backup" - "Start" in the backup run.

This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to interfere with the backup process as you see fit.

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

Specify destination path for the script to use. This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to interfere with the backup process as you see fit.

Order: Pay attention to the order 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 they are in the backup job. If the script is a function that should 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 VBScript you created yourself to a job in a different way. Go to „Options“ and there to „Settings for this job“. You will find options to run „Before Backup“ and options to run „After Backup“. Add your VBScript to the desired location. Note that with this method, Langmeier Backup's own functions  such as SendSMS or Backup described above are not available. However, you can use this method to call any batch scripts or any compiled exe files.

This is a tutorial on how to create your own VBScripts in Langmeier Backup Business and Langmeier Backup Server to intervene in the backup process as you see fit.

 

The specifications in this article are available in the following products:

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

 

Christmas without data loss

Protect all your files.

Secure 25% discount now!   Buy Now   Try it for free
15
Days
17
Hours
22
Minutes
35
Seconds

Langmeier Backup 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 maintain full control and focus on growing your business. Simplicity and reliability are my guiding principles and inspire me every day.
 

Further lookup: Langmeier Backup, VB-Script, Backup

Articles relevant to the topic
Which backup type is the best choice for my data?
This is how important data backup is in real life
The pros and cons of the different Windows file systems


Post a comment here...

This article covers:
Langmeier Backup Script
VBS Backup
Backup Software with VBScript
Langmeier Backup VBS