Re: NT Backup Command Line

Tech-Archive recommends: Fix windows errors by optimizing your registry



You can't put the exclusions on the command line--you have to use a created ..bks file which you can create using the gui.

Here's a recent example I used--much of it taken from a Microsoft KB article about how to use ntbackup:

I'm showing you a real-world example in daily use--don't worry about the excess stuff if you find it confusing--focus on the ntbackup line itself.

This is backing up to an external USB connected drive G, rather than tape--the ntbackup line would be somewhat different with switches for tape--I can dig up the tape version if you would find it useful--I've got it from the previous Windows 2000 server.

---
@echo off
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l
for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
set tm=%tm::=-%
set dtt=%dt%%tm%
c:\windows\system32\ntbackup.exe backup systemstate "@C:\Documents and Settings\Administrator.journal\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\daily.bks" /F "G:\%computername%-%dtt%.bkf" /D "daily %dtt%" /V:yes /M normal /J "daily %dtt%" /L:s /FU
call c:\tools\copylog.cmd
exit
---
copylog copies the log file to a folder on the desktop, and also uses BLAT to mail it to a couple of folks:
---
del c:\tools\*.log
xcopy "c:\documents and settings\administrator.journal\local settings\application data\microsoft\windows nt\ntbackup\data\*.log" c:\tools

dir c:\tools\*.log /b /od >c:\tools\ordered.txt

echo %date% >c:\tools\copylogx.txt
echo %time% >>c:\tools\copylogx.txt

type c:\tools\copylog.txt >>c:\tools\copylogx.txt
rem c:\tools\uptime /s /a >>c:\tools\copylogx.txt

for /F "skip=9" %%1 IN (ordered.txt) do rename %%1 current.log

rem current.log is Unicode, so won't go in a text message.
type c:\tools\current.log >c:\tools\%dtt%.log
rem above converts current.log from unicode to ascii.

xcopy %dtt%.log "c:\documents and settings\administrator.journal\desktop\backup logs\" <f.txt

c:\tools\blat.exe c:\tools\copylogx.txt -t [email addresses go here] -s "%dtt% backup output" -attacht c:\tools\%dtt%.log

del ordered.txt
del copylogx.txt
---

This works--it's been running for some months now on a Windows Server 2003 machine. I'm sure some of it could be done more elegantly, but I haven't tinkered with it in a long time. It was "translated" from Windows 2000 to Windows Server 2003 a few months back when they got a new server.

"vcapone" <vcapone@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:52D2AFED-B1CB-40F4-ABE1-821E92938AE3@xxxxxxxxxxxxxxxx
Hi, I am using the NT command line backup system temporarily. I wanted to
know if there was any way of omitting files and/or directories from the
backup through the command line?

Thank You,

Vinny

.



Relevant Pages

  • RE: ClickOnce Signing
    ... They prompt me for the password even though I enter it on the command line. ... If I don't enter it on the command line the files don't get created correctly. ... @echo off ... del %AppName%_Certificate.cer ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: 16-bit under WinXP Pro?
    ... @echo off ... goto end ... del epurmess.res ... The echo message command is useful when echo is turned off. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: FORFILES error, "The system cannot find the file specified"
    ... "cmd /c del @FILE" ... Both Del and Echo are INTERNAL commands, i.e., part of CMD.exe and ... cannot "run" without Cmd.exe (or some similar command processor) running. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Extended partition new size not shown in My Computer Server 20
    ... Microsoft Connect welcome page. ... Am I correct in thinking that there should be a new version of DiskPart ... Further states Windows Server 2003 with service ... The hotfix includes a new Diskpart.exe utility command not currently ...
    (microsoft.public.windows.file_system)
  • Wanted: powerful extended DIR or FIND utility.
    ... >From windows server 2003 command line, I want to be able to search a ... The windows DIR command cannot list the path as well as the date and ... FIND from GNU utilities for Win32, is excellent, except I get "System ... Bad file descriptor" on folders it cannot access. ...
    (microsoft.public.windows.server.scripting)