\[Editor's Note: Email your scripting solutions (400 words or less) to Reader to Reader at firstname.lastname@example.org. Please include your script and phone number. We edit submissions for style, grammar, and length. If we print your contribution, you receive $100.\]
I'm the network administrator for several of my company's sites in Hungary. Like most IT departments, my IT department is expected to control costs yet still provide effective IT services.
Recently, the human resources (HR) department moved its payroll functions to a separate physical network for security reasons. I needed to provide a separate backup software solution for this network, but I wasn't authorized to purchase any additional software. Thus, I decided to use the Microsoft Windows NT Server 4.0 Resource Kit's Ntbackup utility.
After reading in Dino Esposito's various "Understanding VBScript" and "VBScripting Solutions" columns about how to use VBScript code to improve network administration efficiency, I decided to use a .vbs file to automate running Ntbackup. The script Backup.vbs is the result.
I wrote Backup.vbs for NT 4.0. (The script won't work on Windows 2000.) You can download this script from the Code Library on the Windows Scripting Solutions Web site (http://www.winscriptingsolutions.com).
Backup.vbs uses the resource kit's Logevent utility to write to the NT Event Viewer. This utility logs two entries to the event log for each file the script backs up. Thus, before running the script, you need to make sure you have enough space in your event log. In addition, you need to perform these steps:
- Customize the paths to the folders containing the current and archived logs in the code
LogFolderPath = "C:\log" ArchivedLogFolder = "C:\log\archive\"
- Customize the path to the log file, and customize the Ntbackup switches in the code
LogFile = "C:\log\backup"&LogDate&".log" ObjShell.Run "ntbackup backup _ C:\ E:\jupi\ /b /v /l"&LogFile, 0, _ TrueYou can learn about the switches you can use in Ntbackup's Help file.
- Customize the path to logevent.exe in the code
Logit = "C:\logevent.exe -r Backup _ -e 2300"&" BackupOK"
Considering that I don't have any formal schooling in programming or scripting, Backup.vbs wasn't difficult to write. Even better, the script provides a low-cost yet effective backup solution.