NTBACKUP Closes withou any clue

  • Thread starter Thread starter FB
  • Start date Start date
F

FB

Guest
Win2003 SP2 STD 64-Bits, IBM xSeries 3650 and LTO-2 Ultrium Tape Drive

I´m trying to build a new Batch to do automated Backup.

All my previous Batches and Jobs were delete, so i colud do "from scratch"
(sometines NTBackup doensn´t work and a manual Backup always worked as an
alternate solution)

Now i wrote an entirely new routine changing from "Wizard Model" to my New
Batch .CMD file

Previously, the NTBackup Wizard was used to build a scheduled task with the
default parameters used on the Scheduled Task



I´m doing a simpe command line with the minimal switches:

c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO Ultrium"
(with or without /um)

The NTBackup app opens and closes with no event in Event Log and a Blank
..LOG file

If i try to use:

c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO Ultrium"

The Backup works fine

The BKS file have a valid structure (i´ve tried systemstate, a path with a
slash "/" in the end.. nothing works) and is in a valid place (i´ve tried on
several diff locations)



The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
command-line BLAT app and variables to extract day of the week and date in
DD-MM-YY format





@echo off
cls

echo.
echo.
echo Rotina de Backup CQI - Versao 1.3fb

echo.
echo.
echo Definindo variaveis de ambiente
echo.
echo.
echo Obtendo a data atual via DATE-TIME
for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
set DataAtualDMA=%dd%/%mm%/%yy%
for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
set SMTPSERVER=MYIPSMTPSERVER
set DESTDOMAIN=MyCompanyDOmain
set TARGET=%COMPUTERNAME%
set CXPOSTAL=MyE-MailAddress
set YESNO=no
set PARAMS=/r:no /rs:no /hc:on /m normal
set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
set BKSFILE="@C:\Documents and Settings\svc-backup\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BACKUP.BKS"
echo.

cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data"
%NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
%DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium" /um

echo.
echo Rotina para enviar o ultimo arquivo de LOG via E-Mail

echo.
echo Obtendo o arquivo mais novo
setlocal ENABLEDELAYEDEXPANSION
set file=N

; rem ***************************
; rem *** set user=%UserProfile%
; rem ***************************
; rem *** if {%1} NEQ {} set user=%1
; rem *** set user=%user:"=%
; rem ***************************

set folder=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data
cd /d %folder%
for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU "N"
set file=%%v


echo.
echo.
echo Enviando E-Mails com os Logs de Backup anexados
blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
%CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
endlocal
exit /b 0
 
Re: NTBACKUP Closes withou any clue


"FB" <FB@discussions.microsoft.com> wrote in message
news:C656BEE6-1966-4A92-90B7-87ECC90A0855@microsoft.com...
> Win2003 SP2 STD 64-Bits, IBM xSeries 3650 and LTO-2 Ultrium Tape Drive
>
> I´m trying to build a new Batch to do automated Backup.
>
> All my previous Batches and Jobs were delete, so i colud do "from scratch"
> (sometines NTBackup doensn´t work and a manual Backup always worked as an
> alternate solution)
>
> Now i wrote an entirely new routine changing from "Wizard Model" to my New
> Batch .CMD file
>
> Previously, the NTBackup Wizard was used to build a scheduled task with
> the
> default parameters used on the Scheduled Task
>
>
>
> I´m doing a simpe command line with the minimal switches:
>
> c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO
> Ultrium"
> (with or without /um)
>
> The NTBackup app opens and closes with no event in Event Log and a Blank
> .LOG file
>
> If i try to use:
>
> c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO Ultrium"
>
> The Backup works fine
>
> The BKS file have a valid structure (i´ve tried systemstate, a path with a
> slash "/" in the end.. nothing works) and is in a valid place (i´ve tried
> on
> several diff locations)
>
>
>
> The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
> command-line BLAT app and variables to extract day of the week and date in
> DD-MM-YY format
>
>
>
>
>
> @echo off
> cls
>
> echo.
> echo.
> echo Rotina de Backup CQI - Versao 1.3fb
>
> echo.
> echo.
> echo Definindo variaveis de ambiente
> echo.
> echo.
> echo Obtendo a data atual via DATE-TIME
> for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
> dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
> set DataAtualDMA=%dd%/%mm%/%yy%
> for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
> set SMTPSERVER=MYIPSMTPSERVER
> set DESTDOMAIN=MyCompanyDOmain
> set TARGET=%COMPUTERNAME%
> set CXPOSTAL=MyE-MailAddress
> set YESNO=no
> set PARAMS=/r:no /rs:no /hc:on /m normal
> set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
> set BKSFILE="@C:\Documents and Settings\svc-backup\Local
> Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BACKUP.BKS"
> echo.
>
> cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
> Data\Microsoft\Windows NT\NTBackup\data"
> %NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
> %DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium" /um
>
> echo.
> echo Rotina para enviar o ultimo arquivo de LOG via E-Mail
>
> echo.
> echo Obtendo o arquivo mais novo
> setlocal ENABLEDELAYEDEXPANSION
> set file=N
>
> ; rem ***************************
> ; rem *** set user=%UserProfile%
> ; rem ***************************
> ; rem *** if {%1} NEQ {} set user=%1
> ; rem *** set user=%user:"=%
> ; rem ***************************
>
> set folder=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
> NT\NTBackup\data
> cd /d %folder%
> for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU
> "N"
> set file=%%v
>
>
> echo.
> echo.
> echo Enviando E-Mails com os Logs de Backup anexados
> blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
> %CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
> endlocal
> exit /b 0


It's hard to say what's wrong. The above batch file performs the
System State backup (which, according to your report, works)
but does not perform the data backup (which, according to your
report, does not work).

Also: How did you create the .bks file? Did you make sure to
save it as a Unicode file?

In your post you mention the variable "pathtobks" but in your
batch file you call it "BKSFile".

Lastly: If this was my own batch file then I would remove the
"exit /b 0" line at the end (because it serves no purpose whatsoever).
 
RE: NTBACKUP Closes withou any clue


1) The "pathtobks" was only informational, not the true implementation

2) The file was created on a Right-Click, "New Text File" basis, probably ANSI
(Where is it written the UNICODE pre-requisite?)

3) Thanks fr the exit /b remark, the piece of code was from JSIInc Tips and
Tricks

I´ll try the UNICODE element of the .BKS File

Currently, only works when the Backup is Systemstate (on the command-line)


"FB" wrote:

> Win2003 SP2 STD 64-Bits, IBM xSeries 3650 and LTO-2 Ultrium Tape Drive
>
> I´m trying to build a new Batch to do automated Backup.
>
> All my previous Batches and Jobs were delete, so i colud do "from scratch"
> (sometines NTBackup doensn´t work and a manual Backup always worked as an
> alternate solution)
>
> Now i wrote an entirely new routine changing from "Wizard Model" to my New
> Batch .CMD file
>
> Previously, the NTBackup Wizard was used to build a scheduled task with the
> default parameters used on the Scheduled Task
>
>
>
> I´m doing a simpe command line with the minimal switches:
>
> c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO Ultrium"
> (with or without /um)
>
> The NTBackup app opens and closes with no event in Event Log and a Blank
> .LOG file
>
> If i try to use:
>
> c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO Ultrium"
>
> The Backup works fine
>
> The BKS file have a valid structure (i´ve tried systemstate, a path with a
> slash "/" in the end.. nothing works) and is in a valid place (i´ve tried on
> several diff locations)
>
>
>
> The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
> command-line BLAT app and variables to extract day of the week and date in
> DD-MM-YY format
>
>
>
>
>
> @echo off
> cls
>
> echo.
> echo.
> echo Rotina de Backup CQI - Versao 1.3fb
>
> echo.
> echo.
> echo Definindo variaveis de ambiente
> echo.
> echo.
> echo Obtendo a data atual via DATE-TIME
> for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
> dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
> set DataAtualDMA=%dd%/%mm%/%yy%
> for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
> set SMTPSERVER=MYIPSMTPSERVER
> set DESTDOMAIN=MyCompanyDOmain
> set TARGET=%COMPUTERNAME%
> set CXPOSTAL=MyE-MailAddress
> set YESNO=no
> set PARAMS=/r:no /rs:no /hc:on /m normal
> set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
> set BKSFILE="@C:\Documents and Settings\svc-backup\Local
> Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BACKUP.BKS"
> echo.
>
> cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
> Data\Microsoft\Windows NT\NTBackup\data"
> %NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
> %DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium" /um
>
> echo.
> echo Rotina para enviar o ultimo arquivo de LOG via E-Mail
>
> echo.
> echo Obtendo o arquivo mais novo
> setlocal ENABLEDELAYEDEXPANSION
> set file=N
>
> ; rem ***************************
> ; rem *** set user=%UserProfile%
> ; rem ***************************
> ; rem *** if {%1} NEQ {} set user=%1
> ; rem *** set user=%user:"=%
> ; rem ***************************
>
> set folder=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
> NT\NTBackup\data
> cd /d %folder%
> for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU "N"
> set file=%%v
>
>
> echo.
> echo.
> echo Enviando E-Mails com os Logs de Backup anexados
> blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
> %CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
> endlocal
> exit /b 0
>
>
 
Re: NTBACKUP Closes withou any clue


Yes it worked!

When i save the file in UNICODE the NTBackup APP works fine!

Tanks



"Pegasus (MVP)" wrote:

>
> "FB" <FB@discussions.microsoft.com> wrote in message
> news:C656BEE6-1966-4A92-90B7-87ECC90A0855@microsoft.com...
> > Win2003 SP2 STD 64-Bits, IBM xSeries 3650 and LTO-2 Ultrium Tape Drive
> >
> > I´m trying to build a new Batch to do automated Backup.
> >
> > All my previous Batches and Jobs were delete, so i colud do "from scratch"
> > (sometines NTBackup doensn´t work and a manual Backup always worked as an
> > alternate solution)
> >
> > Now i wrote an entirely new routine changing from "Wizard Model" to my New
> > Batch .CMD file
> >
> > Previously, the NTBackup Wizard was used to build a scheduled task with
> > the
> > default parameters used on the Scheduled Task
> >
> >
> >
> > I´m doing a simpe command line with the minimal switches:
> >
> > c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO
> > Ultrium"
> > (with or without /um)
> >
> > The NTBackup app opens and closes with no event in Event Log and a Blank
> > .LOG file
> >
> > If i try to use:
> >
> > c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO Ultrium"
> >
> > The Backup works fine
> >
> > The BKS file have a valid structure (i´ve tried systemstate, a path with a
> > slash "/" in the end.. nothing works) and is in a valid place (i´ve tried
> > on
> > several diff locations)
> >
> >
> >
> > The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
> > command-line BLAT app and variables to extract day of the week and date in
> > DD-MM-YY format
> >
> >
> >
> >
> >
> > @echo off
> > cls
> >
> > echo.
> > echo.
> > echo Rotina de Backup CQI - Versao 1.3fb
> >
> > echo.
> > echo.
> > echo Definindo variaveis de ambiente
> > echo.
> > echo.
> > echo Obtendo a data atual via DATE-TIME
> > for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
> > dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
> > set DataAtualDMA=%dd%/%mm%/%yy%
> > for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
> > set SMTPSERVER=MYIPSMTPSERVER
> > set DESTDOMAIN=MyCompanyDOmain
> > set TARGET=%COMPUTERNAME%
> > set CXPOSTAL=MyE-MailAddress
> > set YESNO=no
> > set PARAMS=/r:no /rs:no /hc:on /m normal
> > set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
> > set BKSFILE="@C:\Documents and Settings\svc-backup\Local
> > Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BACKUP.BKS"
> > echo.
> >
> > cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
> > Data\Microsoft\Windows NT\NTBackup\data"
> > %NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
> > %DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium" /um
> >
> > echo.
> > echo Rotina para enviar o ultimo arquivo de LOG via E-Mail
> >
> > echo.
> > echo Obtendo o arquivo mais novo
> > setlocal ENABLEDELAYEDEXPANSION
> > set file=N
> >
> > ; rem ***************************
> > ; rem *** set user=%UserProfile%
> > ; rem ***************************
> > ; rem *** if {%1} NEQ {} set user=%1
> > ; rem *** set user=%user:"=%
> > ; rem ***************************
> >
> > set folder=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
> > NT\NTBackup\data
> > cd /d %folder%
> > for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU
> > "N"
> > set file=%%v
> >
> >
> > echo.
> > echo.
> > echo Enviando E-Mails com os Logs de Backup anexados
> > blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
> > %CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
> > endlocal
> > exit /b 0

>
> It's hard to say what's wrong. The above batch file performs the
> System State backup (which, according to your report, works)
> but does not perform the data backup (which, according to your
> report, does not work).
>
> Also: How did you create the .bks file? Did you make sure to
> save it as a Unicode file?
>
> In your post you mention the variable "pathtobks" but in your
> batch file you call it "BKSFile".
>
> Lastly: If this was my own batch file then I would remove the
> "exit /b 0" line at the end (because it serves no purpose whatsoever).
>
>
>
 
Re: NTBACKUP Closes withou any clue

Thanks for the feedback.

"FB" <FB@discussions.microsoft.com> wrote in message
news:2F136EA3-0C69-48D6-9E9B-5A0E4F7D74EF@microsoft.com...
>
> Yes it worked!
>
> When i save the file in UNICODE the NTBackup APP works fine!
>
> Tanks
>
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "FB" <FB@discussions.microsoft.com> wrote in message
>> news:C656BEE6-1966-4A92-90B7-87ECC90A0855@microsoft.com...
>> > Win2003 SP2 STD 64-Bits, IBM xSeries 3650 and LTO-2 Ultrium Tape Drive
>> >
>> > I´m trying to build a new Batch to do automated Backup.
>> >
>> > All my previous Batches and Jobs were delete, so i colud do "from
>> > scratch"
>> > (sometines NTBackup doensn´t work and a manual Backup always worked as
>> > an
>> > alternate solution)
>> >
>> > Now i wrote an entirely new routine changing from "Wizard Model" to my
>> > New
>> > Batch .CMD file
>> >
>> > Previously, the NTBackup Wizard was used to build a scheduled task with
>> > the
>> > default parameters used on the Scheduled Task
>> >
>> >
>> >
>> > I´m doing a simpe command line with the minimal switches:
>> >
>> > c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO
>> > Ultrium"
>> > (with or without /um)
>> >
>> > The NTBackup app opens and closes with no event in Event Log and a
>> > Blank
>> > .LOG file
>> >
>> > If i try to use:
>> >
>> > c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO
>> > Ultrium"
>> >
>> > The Backup works fine
>> >
>> > The BKS file have a valid structure (i´ve tried systemstate, a path
>> > with a
>> > slash "/" in the end.. nothing works) and is in a valid place (i´ve
>> > tried
>> > on
>> > several diff locations)
>> >
>> >
>> >
>> > The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
>> > command-line BLAT app and variables to extract day of the week and date
>> > in
>> > DD-MM-YY format
>> >
>> >
>> >
>> >
>> >
>> > @echo off
>> > cls
>> >
>> > echo.
>> > echo.
>> > echo Rotina de Backup CQI - Versao 1.3fb
>> >
>> > echo.
>> > echo.
>> > echo Definindo variaveis de ambiente
>> > echo.
>> > echo.
>> > echo Obtendo a data atual via DATE-TIME
>> > for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
>> > dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
>> > set DataAtualDMA=%dd%/%mm%/%yy%
>> > for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
>> > set SMTPSERVER=MYIPSMTPSERVER
>> > set DESTDOMAIN=MyCompanyDOmain
>> > set TARGET=%COMPUTERNAME%
>> > set CXPOSTAL=MyE-MailAddress
>> > set YESNO=no
>> > set PARAMS=/r:no /rs:no /hc:on /m normal
>> > set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
>> > set BKSFILE="@C:\Documents and Settings\svc-backup\Local
>> > Settings\Application Data\Microsoft\Windows
>> > NT\NTBackup\data\BACKUP.BKS"
>> > echo.
>> >
>> > cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
>> > Data\Microsoft\Windows NT\NTBackup\data"
>> > %NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
>> > %DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium"
>> > /um
>> >
>> > echo.
>> > echo Rotina para enviar o ultimo arquivo de LOG via E-Mail
>> >
>> > echo.
>> > echo Obtendo o arquivo mais novo
>> > setlocal ENABLEDELAYEDEXPANSION
>> > set file=N
>> >
>> > ; rem ***************************
>> > ; rem *** set user=%UserProfile%
>> > ; rem ***************************
>> > ; rem *** if {%1} NEQ {} set user=%1
>> > ; rem *** set user=%user:"=%
>> > ; rem ***************************
>> >
>> > set folder=%USERPROFILE%\Local Settings\Application
>> > Data\Microsoft\Windows
>> > NT\NTBackup\data
>> > cd /d %folder%
>> > for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU
>> > "N"
>> > set file=%%v
>> >
>> >
>> > echo.
>> > echo.
>> > echo Enviando E-Mails com os Logs de Backup anexados
>> > blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
>> > %CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
>> > endlocal
>> > exit /b 0

>>
>> It's hard to say what's wrong. The above batch file performs the
>> System State backup (which, according to your report, works)
>> but does not perform the data backup (which, according to your
>> report, does not work).
>>
>> Also: How did you create the .bks file? Did you make sure to
>> save it as a Unicode file?
>>
>> In your post you mention the variable "pathtobks" but in your
>> batch file you call it "BKSFile".
>>
>> Lastly: If this was my own batch file then I would remove the
>> "exit /b 0" line at the end (because it serves no purpose whatsoever).
>>
>>
>>
 
Back
Top