Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


August 1997

Using NT for Scheduled Network Backups


RSS
Subscribe to Windows IT Pro | See More Backup and Recovery Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

For small businesses on a budget, backing up network systems can be expensive, time-consuming, and difficult. I developed a solution that makes network backup more economical by using built-in tools on Windows NT 3.51 and 4.0 systems. My solution consists of a simple backup script (batch file) that contains commands for running the NT backup utility--NTBACKUP. You use the NT Command Scheduler or AT command to schedule when the script will run. These tools let you perform unattended scheduled backups of any network drive you can connect to, including shared drives on Windows 95 and Windows 3.11 machines and NT systems.

Getting Ready
To use this backup method, you need Administrator privileges. Also, you must install a tape backup device on the NT machine on which you'll run the backup script.

Before writing the script, make sure you can connect to (i.e., mount) shared drives on the machines you want to back up. In a workgroup environment that has a separate user database for every system, you must have an account with sufficient privileges on each machine. I recommend creating an account for the sole purpose of backing up the system. Give this user a name such as Backer, and assign it the User and Backup Operator groups only. If you use domains, create a user on the Primary Domain Controller (PDC) with the group settings mentioned above; use this account to connect to all shared drives.

An easy way wto test whether a user has sufficient privileges is to try to connect to the shared drive under File Manager, while substituting the new user in the Connect As box in the Connect Network Drive menu option. If you receive the Network path was not found error, the share is unreachable, and you need to verify that the share is present. If you receive the Access denied error, you probably don't have sufficient privileges; correct this at the share by including access to all users (if security is not a concern) or only to the user you created to conduct the backup operations.

Before you write the script, you also must decide where to save the log files. I recommend an easy-to-remember yet secure location on the server that is doing the backup. I place the log files in a directory called LogFiles, in a subdirectory of the NT system directory. If you choose to store the log files on a network drive, make sure your connection will be stable for the duration of the backup.

At this point, you might find it convenient to organize a list of the names of the machines you want to back up, the shared drive names on those systems, and passwords required to connect to those systems or drives. Before you start the backup, test whether you can connect to the shared drives and have authority to back up all appropriate files.

Creating a Backup Script
Listing 1 shows the commands for a sample backup script (BACKUP.BAT). The script follows a basic format. First, you connect to a shared drive on a remote NT machine and assign it a drive letter. Next, you use the NTBACKUP command to copy the drive's contents to tape. When NTBACKUP has finished copying the drive, you delete the mount (i.e., disconnect the share) and start again on another shared drive. In this way, you back up all shared drives sequentially. NT adds each shared drive's contents (i.e., backup set) in turn to the backup tape, and each backup set has a section in the backup log.

Exploring the Backup Script
You can write the script using any text editor. Use the sample as a template for your script, although you will need to change some arguments for your system's specific configuration. Words in angle brackets are sample text; you must change them to fit your network environment. For example, in the first line,

net send <user> Backup Started

you must change the word user to an actual user who will receive the message Backup Started when NT runs the script. The sample script includes net send messages at the beginning and the end to let the user know that the script started and ended successfully. The messages also include, by default, the times the system sent the messages. Because these times correspond to the start and end times of your script, you can easily calculate how long the entire script took to run.

The statement in callout A in Listing 1 tells the system to perform several tasks: Back up the local C drive, include a comment (/d), include the local Registry in the backup (/b), use hardware compression (/hc:on), perform a particular backup type (/t), write the results to a log file called backup.log (/l), and designate which tape drive you want to use (/tape). Note that the /t switch can be followed by normal, copy, incremental, differential, or daily, depending on the type of backup you want to do. You set another switch, /tape, to 0, if you're using the first tape drive installed. A value of 1 means the second tape drive, 2 the third, and so forth.

Notice also that I include a full path to the log file, starting with the environmental variable %windir%. This variable lets you use the script on other machines with little modification.

The lines in callout B in Listing 1 tell the system to back up a network shared drive on an NT system. First, you connect to the share and assign it a local drive letter (in this case, X). This line uses the authority of user Backer in domain domainname to connect a share on a workstation. You must include this user's password in the script. Because the program saves this script as ASCII text and anyone with sufficient privileges can read the script, a security risk exists. This risk is one reason to create a user with limited authority only for backing up shares.

Next, the script issues an NTBACKUP command to back up the X drive. This line differs from the previous backup command (A) in two ways. First, NT appends this backup set to the previous one (/a), so the previous backup sets aren't erased. Second, this line has no /b switch telling the program to include the Registry with the backup. The current version of NTBACKUP lets you back up the Registry of the local machine only. To safely back up the Registry, including the user database (/s), you must make a repair disk at the console for each machine. Of course, you can use the same Emergency Repair Disk (ERD) for identically configured systems. You will need this disk later if you have to restore a network drive that contained a functional NT system. (For information about ERDs, see Michael D. Reilly, "The Emergency Repair Disk," January 1997).

Because the number of shares you back up might change or exceed the number of available drive letters on your system, always disconnect the share after you've backed it up. Doing so cleanly terminates your session with this network share and lets you reuse the drive letter. The command

net use x: /delete

disconnects the share and frees the X drive letter.

This script also includes commands (C) for backing up a Windows 3.11 machine. Use the same syntax for Win95 machines. This system need not be in your workgroup or domain, but you must be able to resolve its Universal Naming Convention (UNC) name (e.g., \\computername). Assuming a password protects the shared drive, you connect to the share by executing the command in line 11. This statement doesn't include usernames because only passwords, not user authorization, protect Win95 and Win 3.11 shares. However, the command to back up the share is the same as that for the NT workstation. The next line disconnects the share. You can, of course, back up any number of different shares, which may include other types of systems, provided you can connect to their shares.

   Previous  [1]  2  Next 


Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

How can I stop and start services from the command line?

...


Storage Whitepapers Combining Deduplication and VMware Disaster Recovery: Cascading Savings Improves Cost Effectiveness

Virtualizing Microsoft Exchange Server 2007

StoreVault SnapManagers for Microsoft Exchange and SQL Server

Related Events Storage Consolidation for Your Microsoft Applications: Reducing Cost and Complexity

SQL Server 2008 – Can You Wait? | Philadelphia

Virtualization, Automation and Databases

Check out our list of Free Email Newsletters!

Storage eBooks A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Keeping Your Business Safe from Attack: Encryption and Certificate Services

Related Storage Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing