|
bn-backup.js is a backup program designed to run on Windows 2000 and 2003
platforms and can be used on Windows XP too. Written in jscript it utilises Microsoft's ntbackup.exe
and rsm.exe utilities. It must be executed by cscript, not wscript, as
it was not designed with a GUI in mind but was designed to be run via
the scheduler without the console logged in. In order to be able to email the
results and logs it requires the SMTP service to be running on the same
host as the script. To begin with
ensure the following:
SMTP is installed and
configured
ntbackup is installed
The RSM (Removable Storage Manager) is running
Using the registry editor set the
following value to 1:
HKCU\Software\Microsoft\NTbackup\Log Files\Log File Count
The script requires that it us
supplied with a backup name on the command line, this argument has maximum length of 28 characters
and is used when generating the tape label and the email subject line.
For example:
Customer name: "Acme Widgets"
Hostname: FS01
Date: 1st January 2006
Script Argument: "Monday"
Tape Label:
"FS01
Monday 20060101 Backup - 1"
Email subject: "Acme Widgets
FS01 Monday 20060101 Backup log"
The main backup configuration is achieved by editing the data in the
xData() function at the end of the script. We will go through each
parameter in turn giving a brief expmanation. Remember as its jscript
'\' special characters need prefixing with the escape character '\',
file paths needing '\\' instead of the file system '\'.
I recommend the logging flags are set to the following under normal
conditions, and set it to 0xFFFFFFFF for maximum logging.
case 1001: // Logging flags
answer = 0xFFFFBFF0;
The log file path is used to set the folder where the log files are left
case 1011: // Log File Path
answer = "C:\\Logs";
The log filename is for the script
log, not the backup log, this logs the process of operating the tape
drive (where applicable), running ntbackup, and various file operations.
case 1012: // Log File Name
answer = "bn-backup.xml";
The log event information name is
the default source for logevents in script log.
case 1014: // Log Event Information Name
answer = "bn-backup";
The system name can normally be
left as a function call which allows the script to read the hostname for
itself, you can however specify a constant here if you wish.
case 2013: // This system's name
answer = GetData_CompName();
Again, the Operating System can be
read directly from the OS itself by using the default function call but
you can specify a constant if you wish.
case 2014: // This system's OS
answer = GetData_OS();
The customer name is used in the
logs and the email subject line.
case 3001: // Customer Company name
answer = "Customer";
Enable Microsoft Exchange backup, this
allows the program to report the size of the Exchange stores in the log.
case 3111: // Is this an Exchange server (yes/no) ?
answer = "no";
Specify the path to Exchange store
files
case 3112: // Exchange mailbox store rich text dB filename including
full path
answer = "c:\\program Files\\Exchsrvr\\mdbdata\\priv1.edb";
case 3113: // Exchange mailbox store streaming dB filename including
full path
answer = "c:\\program Files\\Exchsrvr\\mdbdata\\priv1.stm";
case 3114: // Exchange public store rich text dB filename including full
path
answer = "c:\\program Files\\Exchsrvr\\mdbdata\\pub1.edb";
case 3115: // Exchange public store streaming dB filename including full
path
answer = "c:\\program Files\\Exchsrvr\\mdbdata\\pub1.stm";
Enable Sharepoint backup
case 3121: // Is this a Sharepoint server (yes/no) ?
answer = "no";
Specify the path to the Sharepoint
admin utility used in the Sharepoint backup. The script uses the
Microsoft supplied utility stsadm.exe to backup the Sharepoint databases
to file, the files should be included in one of the backup data sets
specified later (4051 and 4052)
case 3122: // STS Admin utility path
answer = "\"C:\\Program Files\\Common Files\\Microsoft Shared\\web
server extensions\\60\\BIN\\stsadm.exe\"";
The location for the Sharepoint
backup file
case 3123: //STS backup file with full path
answer = "c:\\admin\\backup\\STS\\sitebackup.dat";
Where to find ntbackup, normall c:\winnt on Windows 2000 and
c:\windows on Windows 2003 and XP
case 4002: // Backup utility location
answer = "C:\\Winnt\\system32\\ntbackup.exe";
The name of the temporary file the
script uses during processing, stored in the temporary path specified in
1011.
case 4003: // Temporary work file
answer = "bn-temp.log";
The name of the tape utility log
used by the script for logging tape operations
case 4004: // Tape utility log
answer = "bn-tape.log";
The concatenation file is used to
collect all the ntbackup log files together. Each backup set is run as a
separate backup and therefore each produces a separate ntbackup log. At
the end of each backup set the ntbackup log is added to the
concatenantion file.
case 4005: // Concatenation file for multiple logs
answer = "bn-backup.log";
ntbackup saves its log files in the
profile of the user account the script is run under. The log file
location (4006) normally does not need changing as this is the standard
place holder that ntbackup uses, however the profile name (4007) often
does, you should not assume it's administrator if using the
administrator account, depending on the history of the host it could be
administrator.000, administrator.[domain] etc.
case 4006: // Backup program's logfile location
answer = "C:\\Documents and Settings\\";
answer += xData(4007);
answer += "\\Local Settings\\Application Data\\Microsoft";
answer += "\\Windows NT\\NTbackup\\Data\\backup01.log";
case 4007: // Backup user profile folder name
answer = "administrator";
The from address for the email
generated at the end of the backup. If left at the default it will be
bn-backup.[hostname]@[public DNS domain]. Otherwise you specify your own
in the form of a constant.
case 4021: // This script's email address
answer = "bn-backup." + GetData_CompName() + "@" + xData(4022);
The public DNS domain used for
emailing, this needs setting to your own domain
case 4022: // Public DNS domain
answer = "domain.co.uk";
The service monitor address is the address to which the email should be
sent.
case 4023: // Service monitor email address
answer = "backup.administrator@domain.co.uk";
Specify the backup device,
currently the scripts only supports tape or disk.
case 4030: // Backup device? Currently supports 'tape' or 'disk'
answer = "tape";
Enable tape eject after backup,
only relevant if 4030 is configured for tape
case 4031: // Eject tape after backup?
answer = "yes";
The media pool to use if backing up
to tape
case 4032: // Media Pool to use
answer = "LTO Ultrium";
The tape drive settling time, a
delay postfixed to tape operations to allow the drive to complete
current operations and be ready for the next. The default is normally
quite adequate.
case 4033: // Tape drive settling time in minutes
answer = 1;
The rsm GUID for the tape drive,
this is used to identify the drive in drive operations.
case 4034: //Tape drive rsm GUID -to find use: rsm view /tlibrary
/guiddisplay
answer = "";
The destination for file based backup, can be drive: or UNC format
case 4040: //Destination for disk based backups
answer = "";
The location of the backup
selection files. You will need to generate these using ntbackup,go to
the backup tab, select the folders you want to backup and save from the
file menu. Exchange backups must be separate and I suggest
you have at least one for the OS and data, one for Exchange and one for
the system state. The script expects the Exchange backup to be set 3.
case 4051: // backup set 1
answer = "@c:\\admin\\backup\\drive-c.bks";
case 4052: // backup set 2
answer = "@c:\\admin\\backup\\drive-d.bks";
case 4053: // backup set 3 - This must be the ExchangeIS set and only
the Exchange set
answer = "@c:\\admin\\backup\\exchange.bks";
case 4054: // backup set 4
answer = "@c:\\admin\\backup\\systemstate.bks";
|