How to Save Backup Report Logs to an Alternate Location (241162)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows 2000 Datacenter Server

This article was previously published under Q241162

SUMMARY

Windows 2000 Backup (Ntbackup.exe) does not have a command-line parameter to specify the location to which reports are saved after a backup operation is finished. The backup report is saved in the profiles folder of the user who performed the backup operation. You can view the reports by clicking Report on the Tools menu in Backup.

Backup keeps only the last 10 backup reports. The corresponding Backup##.log files are located in the "Documents and Settings\User_Name\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data" folder.

You may want to maintain more than the last 10 backup reports, especially if you have a large number of backup tapes or you perform a large number of backup operations and you need to reference the old reports (log files) on a regular basis. This is also useful if multiple users perform backup operations on the same computer and you want all the backup reports to be copied to a common shared folder to make gaining access to the reports easier.

This article describes how to copy and rename the log files so that they are stored in an alternate folder using a Date-time.log naming convention while still allowing Windows 2000 to maintain its own reports (the last 10) in the normal fashion

Note NTbackup.exe cannot append to a single report log file. However, the following registry value controls how many reports are kept before the oldest report is overwritten:

HKEY_CURRENT_USER\Software\Microsoft\Ntbackup\Log Files Log File Count:REG_DWORD:0x0000000a

MORE INFORMATION

This article contains a sample batch file that you can use to start Backup. The batch file copies the current (the last 10) reports to a temporary location, delete the reports, and then starts Backup. After Backup is finished and quits, the batch file copies the newly created backup report to another temporary location so it can be renamed, and then copied to a final depository folder. Finally, the backup reports folder is repopulated with the most current (the last 10) backup reports, followed by folder clean-up operations.

Note This batch file copies only the newly created backup report log file to the final depository folder. It does not copy or rename any pre-existing reports. However, over time (after 10 backup sessions using the batch file), all the reports existing in the user's profile folder will also be located in the final depository folder.

You can further automate this method if you substitute the stand-alone ntbackup.exe command with ntbackup using command-line parameters, and then schedule the complete batch file using Task Scheduler.

To view a list of all available switches and parameters for Ntbackup.exe, type the following line at a command prompt:

ntbackup /?

NOTE: Some of the commands in the following sample batch file are one line; they have been wrapped for readability. The spaces and syntax must be maintained when used in a real batch file. The user name "bkupuser" is used in these commands to represent the user profile folder name of a user. Substitute a real user's logon name for "bkupuser" in your batch file. Make sure that at least one backup session has already been performed so that at least one report log has been created for that user prior to using the batch file.

Sample.bat Batch File

REM Be sure the final destination folder (C:\Bkuplogs) exists before using this batch file. (mkdir c:\bkuplogs)
REM This folder is used as the final resting place for the logs after copying and renaming them.

echo off

mkdir C:\oldlogs

copy "C:\Documents and Settings\bkupuser\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\backup*.log" c:\oldlogs\*.* /y

del "C:\Documents and Settings\bkupuser\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\*.log"

ntbackup.exe

mkdir C:\templog

copy "C:\Documents and Settings\bkupuser\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\backup*.log" c:\templog\*.* /y

copy "C:\Documents and Settings\bkupuser\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\backup*.log" c:\oldlogs\*.* /y

FOR /F "usebackq tokens=1" %%n IN (`dir c:\templog /b`) DO @FOR /F "usebackq tokens=2,3,4 delims=/ " %%d IN (`date /t`) DO @FOR /F "usebackq tokens=1,2 delims=: " %%t IN (`time /t`) DO @ren c:\templog\%%n %%d%%e%%f-%%t%%u.log

copy c:\templog\*.* c:\bkuplogs

del c:\templog\*.log

rmdir /q c:\templog

del "C:\Documents and Settings\bkupuser\Local Settings\Application Data\Microsoft\WindowsNT\NTbackup\Data\*.log"

copy c:\oldlogs\*.log "C:\Documents and Settings\bkupuser\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\*.*" /Y

del c:\oldlogs\*.log

rmdir /q c:\oldlogs

NOTE: Based on the report option (Summary or Detailed) selected on the Backup Log tab (click Options on the Tools menu to view this tab), the backup log files can become quite large. You should monitor and delete old log files manually based on free disk space or log history requirements.

For additional information about using Windows 2000 Backup, click the article numbers below to view the articles in the Microsoft Knowledge Base:

239892 How to Schedule Unattended Backups Using a Stand-Alone Tape Library

224006 How to Manually Delete Reports from the Backup Tool


Modification Type:MinorLast Reviewed:1/9/2004
Keywords:kbhowto KB241162