Jump to content

ntbackup Alerts


Recommended Posts

Posted

Hello all,

 

I am running ntbackup on Windows 2003 Enterprise Edition

 

Would anyone tell me if is there is any way I can configure(bat/

vbscript) whereby ntbackup will alert me by email when the backup job

has completed sucessfully or failed?

 

 

Regards and Thanks,

Guest Masterplan
Posted

RE: ntbackup Alerts

 

Hi,

 

You can use schtasks command to monitor the scheduled tasks. You interogate

the tasks like this:

schtasks /query /v /fo:list | findstr /i "Taskname Result"

And then send the result by email with a program like blat for example.

 

--

Have a nice day!

 

http://winmasterplan.blogspot.com

 

 

"eWINg" wrote:

> Hello all,

>

> I am running ntbackup on Windows 2003 Enterprise Edition

>

> Would anyone tell me if is there is any way I can configure(bat/

> vbscript) whereby ntbackup will alert me by email when the backup job

> has completed sucessfully or failed?

>

>

> Regards and Thanks,

>

>

>

Posted

Re: ntbackup Alerts

 

On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

> Hi,

>

> You can use schtasks command to monitor the scheduled tasks. You interogate

> the tasks like this:

> schtasks /query /v /fo:list | findstr /i "Taskname Result"

> And then send the result by email with a program like blat for example.

>

> --

> Have a nice day!

>

> http://winmasterplan.blogspot.com

>

>

>

> "eWINg" wrote:

> > Hello all,

>

> > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > Would anyone tell me if is there is any way I can configure(bat/

> > vbscript) whereby ntbackup will alert me by email when the backup job

> > has completed sucessfully or failed?

>

> > Regards and Thanks,- Hide quoted text -

>

> - Show quoted text -

 

I can use blat to email the log file, like

c:\windows\system32\blat.exe "%lastfile%" -t "111@ddd.com" -s "Backup

Report" -mime -server "smtp.server" -f "some@senderaddress.com" -q

 

But how can I select the latest log file attach to mail?

Guest Masterplan
Posted

Re: ntbackup Alerts

 

Hi again,

 

You overwrite the old file and write date in the new file daily:

schtasks /query /v /fo:list | findstr /i "Taskname Result" > filename.txt

date /t >> filename.txt

blat.exe "filename.txt" -t "111@ddd.com" -s "Backup

> Report" -mime -server "smtp.server" -f "some@senderaddress.com" -q

 

--

Have a nice day!

 

http://winmasterplan.blogspot.com

 

 

"eWINg" wrote:

> On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

> > Hi,

> >

> > You can use schtasks command to monitor the scheduled tasks. You interogate

> > the tasks like this:

> > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > And then send the result by email with a program like blat for example.

> >

> > --

> > Have a nice day!

> >

> > http://winmasterplan.blogspot.com

> >

> >

> >

> > "eWINg" wrote:

> > > Hello all,

> >

> > > I am running ntbackup on Windows 2003 Enterprise Edition

> >

> > > Would anyone tell me if is there is any way I can configure(bat/

> > > vbscript) whereby ntbackup will alert me by email when the backup job

> > > has completed sucessfully or failed?

> >

> > > Regards and Thanks,- Hide quoted text -

> >

> > - Show quoted text -

>

> I can use blat to email the log file, like

> c:\windows\system32\blat.exe "%lastfile%" -t "111@ddd.com" -s "Backup

> Report" -mime -server "smtp.server" -f "some@senderaddress.com" -q

>

> But how can I select the latest log file attach to mail?

>

Guest Pegasus \(MVP\)
Posted

Re: ntbackup Alerts

 

 

"eWINg" <ewinglai@gmail.com> wrote in message

news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com...

On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

> Hi,

>

> You can use schtasks command to monitor the scheduled tasks. You

> interogate

> the tasks like this:

> schtasks /query /v /fo:list | findstr /i "Taskname Result"

> And then send the result by email with a program like blat for example.

>

> --

> Have a nice day!

>

> http://winmasterplan.blogspot.com

>

>

>

> "eWINg" wrote:

> > Hello all,

>

> > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > Would anyone tell me if is there is any way I can configure(bat/

> > vbscript) whereby ntbackup will alert me by email when the backup job

> > has completed sucessfully or failed?

>

> > Regards and Thanks,- Hide quoted text -

>

> - Show quoted text -

 

I can use blat to email the log file, like

c:\windows\system32\blat.exe "%lastfile%" -t "111@ddd.com" -s "Backup

Report" -mime -server "smtp.server" -f "some@senderaddress.com" -q

 

But how can I select the latest log file attach to mail?

 

==============

 

Which log file are you talking about - the one created by the scheduled task

or the one created by ntbackup.exe?

Posted

Re: ntbackup Alerts

 

On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com...

> On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

>

>

>

>

> > Hi,

>

> > You can use schtasks command to monitor the scheduled tasks. You

> > interogate

> > the tasks like this:

> > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > And then send the result by email with a program like blat for example.

>

> > --

> > Have a nice day!

>

> >http://winmasterplan.blogspot.com

>

> > "eWINg" wrote:

> > > Hello all,

>

> > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > Would anyone tell me if is there is any way I can configure(bat/

> > > vbscript) whereby ntbackup will alert me by email when the backup job

> > > has completed sucessfully or failed?

>

> > > Regards and Thanks,- Hide quoted text -

>

> > - Show quoted text -

>

> I can use blat to email the log file, like

> c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> But how can I select the latest log file attach to mail?

>

> ==============

>

> Which log file are you talking about - the one created by the scheduled task

> or the one created by ntbackup.exe?- Hide quoted text -

>

> - Show quoted text -

 

OH, I mean the log create by ntbackup, which place in

C:\Documents and Settings\Administrator\Local Settings\Application Data

\Microsoft\Windows NT\NTBackup\data

 

how can I select the latest log file attach to mail?

Guest Pegasus \(MVP\)
Posted

Re: ntbackup Alerts

 

 

"eWINg" <ewinglai@gmail.com> wrote in message

news:9f6c66b1-bd4a-4d54-a2c0-5d5c15b9ea59@k13g2000hse.googlegroups.com...

On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com...

> On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

>

>

>

>

> > Hi,

>

> > You can use schtasks command to monitor the scheduled tasks. You

> > interogate

> > the tasks like this:

> > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > And then send the result by email with a program like blat for example.

>

> > --

> > Have a nice day!

>

> >http://winmasterplan.blogspot.com

>

> > "eWINg" wrote:

> > > Hello all,

>

> > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > Would anyone tell me if is there is any way I can configure(bat/

> > > vbscript) whereby ntbackup will alert me by email when the backup job

> > > has completed sucessfully or failed?

>

> > > Regards and Thanks,- Hide quoted text -

>

> > - Show quoted text -

>

> I can use blat to email the log file, like

> c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> But how can I select the latest log file attach to mail?

>

> ==============

>

> Which log file are you talking about - the one created by the scheduled

> task

> or the one created by ntbackup.exe?- Hide quoted text -

>

> - Show quoted text -

 

OH, I mean the log create by ntbackup, which place in

C:\Documents and Settings\Administrator\Local Settings\Application Data

\Microsoft\Windows NT\NTBackup\data

 

how can I select the latest log file attach to mail?

================

You can pick the most recent file with this batch file:

@echo off

set folder=d:\temp files

for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

MostRecent=%%a

echo %MostRecent% is the most recent file.

Posted

Re: ntbackup Alerts

 

On Oct 2, 9:52 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:9f6c66b1-bd4a-4d54-a2c0-5d5c15b9ea59@k13g2000hse.googlegroups.com...

> On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

>

>

> > "eWINg" <ewing...@gmail.com> wrote in message

>

> >news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com....

> > On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

> > > Hi,

>

> > > You can use schtasks command to monitor the scheduled tasks. You

> > > interogate

> > > the tasks like this:

> > > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > > And then send the result by email with a program like blat for example.

>

> > > --

> > > Have a nice day!

>

> > >http://winmasterplan.blogspot.com

>

> > > "eWINg" wrote:

> > > > Hello all,

>

> > > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > > Would anyone tell me if is there is any way I can configure(bat/

> > > > vbscript) whereby ntbackup will alert me by email when the backup job

> > > > has completed sucessfully or failed?

>

> > > > Regards and Thanks,- Hide quoted text -

>

> > > - Show quoted text -

>

> > I can use blat to email the log file, like

> > c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> > Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> > But how can I select the latest log file attach to mail?

>

> > ==============

>

> > Which log file are you talking about - the one created by the scheduled

> > task

> > or the one created by ntbackup.exe?- Hide quoted text -

>

> > - Show quoted text -

>

> OH, I mean the log create by ntbackup, which place in

> C:\Documents and Settings\Administrator\Local Settings\Application Data

> \Microsoft\Windows NT\NTBackup\data

>

> how can I select the latest log file attach to mail?

> ================

> You can pick the most recent file with this batch file:

> @echo off

> set folder=d:\temp files

> for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> MostRecent=%%a

> echo %MostRecent% is the most recent file.- Hide quoted text -

>

> - Show quoted text -

 

Thanks for your help!

 

I wrote a window bat as follow, but it run with error, please HELP!

 

Run bat under:

C:\Documents and Settings\Administrator\Local Settings\Application Data

\Microsoft\Windows NT\NTBackup\data

Error:

The system cannot find the path specified.

"%a " is the most recent file.

 

 

 

@echo off

set folder="C:\Documents and Settings\Administrator\Local Settings

\Application Data\Microsoft\Windows NT\NTBackup\data"

 

for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

set MostRecent=%%a

 

echo "%MostRecent%" is the most recent file.

 

Rem Mail latest log file to us

c:\windows\system32\blat.exe "%MostRecent%" -t "my@mail.com" -s

"Backup Report" -mime -server "smtp.server" -f

"some@senderaddress.com" -q

Guest Pegasus \(MVP\)
Posted

Re: ntbackup Alerts

 

 

"eWINg" <ewinglai@gmail.com> wrote in message

news:278c03a9-3283-4b00-a787-3501b447bb33@m3g2000hsc.googlegroups.com...

On Oct 2, 9:52 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:9f6c66b1-bd4a-4d54-a2c0-5d5c15b9ea59@k13g2000hse.googlegroups.com...

> On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

>

>

> > "eWINg" <ewing...@gmail.com> wrote in message

>

> >news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com...

> > On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

> > > Hi,

>

> > > You can use schtasks command to monitor the scheduled tasks. You

> > > interogate

> > > the tasks like this:

> > > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > > And then send the result by email with a program like blat for

> > > example.

>

> > > --

> > > Have a nice day!

>

> > >http://winmasterplan.blogspot.com

>

> > > "eWINg" wrote:

> > > > Hello all,

>

> > > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > > Would anyone tell me if is there is any way I can configure(bat/

> > > > vbscript) whereby ntbackup will alert me by email when the backup

> > > > job

> > > > has completed sucessfully or failed?

>

> > > > Regards and Thanks,- Hide quoted text -

>

> > > - Show quoted text -

>

> > I can use blat to email the log file, like

> > c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> > Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> > But how can I select the latest log file attach to mail?

>

> > ==============

>

> > Which log file are you talking about - the one created by the scheduled

> > task

> > or the one created by ntbackup.exe?- Hide quoted text -

>

> > - Show quoted text -

>

> OH, I mean the log create by ntbackup, which place in

> C:\Documents and Settings\Administrator\Local Settings\Application Data

> \Microsoft\Windows NT\NTBackup\data

>

> how can I select the latest log file attach to mail?

> ================

> You can pick the most recent file with this batch file:

> @echo off

> set folder=d:\temp files

> for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> MostRecent=%%a

> echo %MostRecent% is the most recent file.- Hide quoted text -

>

> - Show quoted text -

 

Thanks for your help!

 

I wrote a window bat as follow, but it run with error, please HELP!

 

Run bat under:

C:\Documents and Settings\Administrator\Local Settings\Application Data

\Microsoft\Windows NT\NTBackup\data

Error:

The system cannot find the path specified.

"%a " is the most recent file.

 

 

 

@echo off

set folder="C:\Documents and Settings\Administrator\Local Settings

\Application Data\Microsoft\Windows NT\NTBackup\data"

 

for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

set MostRecent=%%a

 

echo "%MostRecent%" is the most recent file.

 

Rem Mail latest log file to us

c:\windows\system32\blat.exe "%MostRecent%" -t "my@mail.com" -s

"Backup Report" -mime -server "smtp.server" -f

"some@senderaddress.com" -q

 

You added a set of double quotes to Line #2 which I did not have. You also

broke up the line below it and added an extra "set" word. Here is my batch

file again, this time line-numbered:

Line1: @echo off

Line2: set folder=d:\temp files

Line3: for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

MostRecent=%%a

Line4: echo %MostRecent% is the most recent file.

Posted

Re: ntbackup Alerts

 

On Oct 3, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:278c03a9-3283-4b00-a787-3501b447bb33@m3g2000hsc.googlegroups.com...

> On Oct 2, 9:52 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

>

>

> > "eWINg" <ewing...@gmail.com> wrote in message

>

> >news:9f6c66b1-bd4a-4d54-a2c0-5d5c15b9ea59@k13g2000hse.googlegroups.com....

> > On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

> > > "eWINg" <ewing...@gmail.com> wrote in message

>

> > >news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com....

> > > On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

> > > > Hi,

>

> > > > You can use schtasks command to monitor the scheduled tasks. You

> > > > interogate

> > > > the tasks like this:

> > > > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > > > And then send the result by email with a program like blat for

> > > > example.

>

> > > > --

> > > > Have a nice day!

>

> > > >http://winmasterplan.blogspot.com

>

> > > > "eWINg" wrote:

> > > > > Hello all,

>

> > > > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > > > Would anyone tell me if is there is any way I can configure(bat/

> > > > > vbscript) whereby ntbackup will alert me by email when the backup

> > > > > job

> > > > > has completed sucessfully or failed?

>

> > > > > Regards and Thanks,- Hide quoted text -

>

> > > > - Show quoted text -

>

> > > I can use blat to email the log file, like

> > > c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> > > Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> > > But how can I select the latest log file attach to mail?

>

> > > ==============

>

> > > Which log file are you talking about - the one created by the scheduled

> > > task

> > > or the one created by ntbackup.exe?- Hide quoted text -

>

> > > - Show quoted text -

>

> > OH, I mean the log create by ntbackup, which place in

> > C:\Documents and Settings\Administrator\Local Settings\Application Data

> > \Microsoft\Windows NT\NTBackup\data

>

> > how can I select the latest log file attach to mail?

> > ================

> > You can pick the most recent file with this batch file:

> > @echo off

> > set folder=d:\temp files

> > for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> > MostRecent=%%a

> > echo %MostRecent% is the most recent file.- Hide quoted text -

>

> > - Show quoted text -

>

> Thanks for your help!

>

> I wrote a window bat as follow, but it run with error, please HELP!

>

> Run bat under:

> C:\Documents and Settings\Administrator\Local Settings\Application Data

> \Microsoft\Windows NT\NTBackup\data

> Error:

> The system cannot find the path specified.

> "%a " is the most recent file.

>

> @echo off

> set folder="C:\Documents and Settings\Administrator\Local Settings

> \Application Data\Microsoft\Windows NT\NTBackup\data"

>

> for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> set MostRecent=%%a

>

> echo "%MostRecent%" is the most recent file.

>

> Rem Mail latest log file to us

> c:\windows\system32\blat.exe "%MostRecent%" -t "m...@mail.com" -s

> "Backup Report" -mime -server "smtp.server" -f

> "s...@senderaddress.com" -q

>

> You added a set of double quotes to Line #2 which I did not have. You also

> broke up the line below it and added an extra "set" word. Here is my batch

> file again, this time line-numbered:

> Line1: @echo off

> Line2: set folder=d:\temp files

> Line3: for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> MostRecent=%%a

> Line4: echo %MostRecent% is the most recent file.- Hide quoted text -

>

> - Show quoted text -

Thanks for your help!

I complete the task with the following script.

Please point me out, if there's anything can improve. thanks a lot!

 

 

 

@echo on

setlocal

 

 

Rem Set folder name containing backup log files

set fld=C:\Documents and Settings\Administrator\Local Settings

\Application Data\Microsoft\Windows NT\NTBackup\data\

 

Rem This dir command will list all log files sorted by date in bare

format

set fcmd=dir "%fld%*.log" /OD /A-D /B

 

Rem set command will set lastf variable to the last file in set, i.e.

the latest one

for /F "tokens=* delims= " %%i in ('%fcmd%') do set lastf=%fld%%%i

 

 

Rem Mail latest log file to us

c:\windows\system32\blat.exe "%lastf%" -t "recciver@mail.address" -s

"Backup Report" -mime -server "smtp.XXX.org" -f

"bkpserver@mailaddress" -q

Guest Pegasus \(MVP\)
Posted

Re: ntbackup Alerts

 

 

"eWINg" <ewinglai@gmail.com> wrote in message

news:d3369867-6529-43e2-b5d0-c62914b1bb83@a18g2000pra.googlegroups.com...

On Oct 3, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:278c03a9-3283-4b00-a787-3501b447bb33@m3g2000hsc.googlegroups.com...

> On Oct 2, 9:52 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

>

>

> > "eWINg" <ewing...@gmail.com> wrote in message

>

> >news:9f6c66b1-bd4a-4d54-a2c0-5d5c15b9ea59@k13g2000hse.googlegroups.com...

> > On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

> > > "eWINg" <ewing...@gmail.com> wrote in message

>

> > >news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com...

> > > On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

> > > > Hi,

>

> > > > You can use schtasks command to monitor the scheduled tasks. You

> > > > interogate

> > > > the tasks like this:

> > > > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > > > And then send the result by email with a program like blat for

> > > > example.

>

> > > > --

> > > > Have a nice day!

>

> > > >http://winmasterplan.blogspot.com

>

> > > > "eWINg" wrote:

> > > > > Hello all,

>

> > > > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > > > Would anyone tell me if is there is any way I can configure(bat/

> > > > > vbscript) whereby ntbackup will alert me by email when the backup

> > > > > job

> > > > > has completed sucessfully or failed?

>

> > > > > Regards and Thanks,- Hide quoted text -

>

> > > > - Show quoted text -

>

> > > I can use blat to email the log file, like

> > > c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> > > Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> > > But how can I select the latest log file attach to mail?

>

> > > ==============

>

> > > Which log file are you talking about - the one created by the

> > > scheduled

> > > task

> > > or the one created by ntbackup.exe?- Hide quoted text -

>

> > > - Show quoted text -

>

> > OH, I mean the log create by ntbackup, which place in

> > C:\Documents and Settings\Administrator\Local Settings\Application Data

> > \Microsoft\Windows NT\NTBackup\data

>

> > how can I select the latest log file attach to mail?

> > ================

> > You can pick the most recent file with this batch file:

> > @echo off

> > set folder=d:\temp files

> > for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> > MostRecent=%%a

> > echo %MostRecent% is the most recent file.- Hide quoted text -

>

> > - Show quoted text -

>

> Thanks for your help!

>

> I wrote a window bat as follow, but it run with error, please HELP!

>

> Run bat under:

> C:\Documents and Settings\Administrator\Local Settings\Application Data

> \Microsoft\Windows NT\NTBackup\data

> Error:

> The system cannot find the path specified.

> "%a " is the most recent file.

>

> @echo off

> set folder="C:\Documents and Settings\Administrator\Local Settings

> \Application Data\Microsoft\Windows NT\NTBackup\data"

>

> for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> set MostRecent=%%a

>

> echo "%MostRecent%" is the most recent file.

>

> Rem Mail latest log file to us

> c:\windows\system32\blat.exe "%MostRecent%" -t "m...@mail.com" -s

> "Backup Report" -mime -server "smtp.server" -f

> "s...@senderaddress.com" -q

>

> You added a set of double quotes to Line #2 which I did not have. You also

> broke up the line below it and added an extra "set" word. Here is my batch

> file again, this time line-numbered:

> Line1: @echo off

> Line2: set folder=d:\temp files

> Line3: for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> MostRecent=%%a

> Line4: echo %MostRecent% is the most recent file.- Hide quoted text -

>

> - Show quoted text -

Thanks for your help!

I complete the task with the following script.

Please point me out, if there's anything can improve. thanks a lot!

 

 

 

@echo on

setlocal

 

 

Rem Set folder name containing backup log files

set fld=C:\Documents and Settings\Administrator\Local Settings

\Application Data\Microsoft\Windows NT\NTBackup\data\

 

Rem This dir command will list all log files sorted by date in bare

format

set fcmd=dir "%fld%*.log" /OD /A-D /B

 

Rem set command will set lastf variable to the last file in set, i.e.

the latest one

for /F "tokens=* delims= " %%i in ('%fcmd%') do set lastf=%fld%%%i

 

 

Rem Mail latest log file to us

c:\windows\system32\blat.exe "%lastf%" -t "recciver@mail.address" -s

"Backup Report" -mime -server "smtp.XXX.org" -f

"bkpserver@mailaddress" -q

 

========================

 

Looks fine to me. I would probably simplify the following line somewhat.

Instead of writing

for /F "tokens=* delims= " %%i in ('%fcmd%') do set lastf=%fld%%%i

I would write

for /F "delims=" %%i in ('%fcmd%') do set lastf=%fld%%%i

 

Note the missing space after the "=" sign.

Posted

Re: ntbackup Alerts

 

On Oct 6, 2:16 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "eWINg" <ewing...@gmail.com> wrote in message

>

> news:d3369867-6529-43e2-b5d0-c62914b1bb83@a18g2000pra.googlegroups.com...

> On Oct 3, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

> > "eWINg" <ewing...@gmail.com> wrote in message

>

> >news:278c03a9-3283-4b00-a787-3501b447bb33@m3g2000hsc.googlegroups.com...

> > On Oct 2, 9:52 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

> > > "eWINg" <ewing...@gmail.com> wrote in message

>

> > >news:9f6c66b1-bd4a-4d54-a2c0-5d5c15b9ea59@k13g2000hse.googlegroups.com....

> > > On Sep 30, 11:46 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

> > > > "eWINg" <ewing...@gmail.com> wrote in message

>

> > > >news:c06bb153-be12-4dae-a1d7-f1504cde481f@e53g2000hsa.googlegroups.com...

> > > > On Sep 30, 4:31 pm, Masterplan <winmasterp...@gmail.com.> wrote:

>

> > > > > Hi,

>

> > > > > You can use schtasks command to monitor the scheduled tasks. You

> > > > > interogate

> > > > > the tasks like this:

> > > > > schtasks /query /v /fo:list | findstr /i "Taskname Result"

> > > > > And then send the result by email with a program like blat for

> > > > > example.

>

> > > > > --

> > > > > Have a nice day!

>

> > > > >http://winmasterplan.blogspot.com

>

> > > > > "eWINg" wrote:

> > > > > > Hello all,

>

> > > > > > I am running ntbackup on Windows 2003 Enterprise Edition

>

> > > > > > Would anyone tell me if is there is any way I can configure(bat/

> > > > > > vbscript) whereby ntbackup will alert me by email when the backup

> > > > > > job

> > > > > > has completed sucessfully or failed?

>

> > > > > > Regards and Thanks,- Hide quoted text -

>

> > > > > - Show quoted text -

>

> > > > I can use blat to email the log file, like

> > > > c:\windows\system32\blat.exe "%lastfile%" -t "1...@ddd.com" -s "Backup

> > > > Report" -mime -server "smtp.server" -f "s...@senderaddress.com" -q

>

> > > > But how can I select the latest log file attach to mail?

>

> > > > ==============

>

> > > > Which log file are you talking about - the one created by the

> > > > scheduled

> > > > task

> > > > or the one created by ntbackup.exe?- Hide quoted text -

>

> > > > - Show quoted text -

>

> > > OH, I mean the log create by ntbackup, which place in

> > > C:\Documents and Settings\Administrator\Local Settings\Application Data

> > > \Microsoft\Windows NT\NTBackup\data

>

> > > how can I select the latest log file attach to mail?

> > > ================

> > > You can pick the most recent file with this batch file:

> > > @echo off

> > > set folder=d:\temp files

> > > for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> > > MostRecent=%%a

> > > echo %MostRecent% is the most recent file.- Hide quoted text -

>

> > > - Show quoted text -

>

> > Thanks for your help!

>

> > I wrote a window bat as follow, but it run with error, please HELP!

>

> > Run bat under:

> > C:\Documents and Settings\Administrator\Local Settings\Application Data

> > \Microsoft\Windows NT\NTBackup\data

> > Error:

> > The system cannot find the path specified.

> > "%a " is the most recent file.

>

> > @echo off

> > set folder="C:\Documents and Settings\Administrator\Local Settings

> > \Application Data\Microsoft\Windows NT\NTBackup\data"

>

> > for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> > set MostRecent=%%a

>

> > echo "%MostRecent%" is the most recent file.

>

> > Rem Mail latest log file to us

> > c:\windows\system32\blat.exe "%MostRecent%" -t "m...@mail.com" -s

> > "Backup Report" -mime -server "smtp.server" -f

> > "s...@senderaddress.com" -q

>

> > You added a set of double quotes to Line #2 which I did not have. You also

> > broke up the line below it and added an extra "set" word. Here is my batch

> > file again, this time line-numbered:

> > Line1: @echo off

> > Line2: set folder=d:\temp files

> > Line3: for /F "delims=" %%a in ('dir /od /b "%folder%\*.log"') do set

> > MostRecent=%%a

> > Line4: echo %MostRecent% is the most recent file.- Hide quoted text -

>

> > - Show quoted text -

>

> Thanks for your help!

> I complete the task with the following script.

> Please point me out, if there's anything can improve. thanks a lot!

>

> @echo on

> setlocal

>

> Rem Set folder name containing backup log files

> set fld=C:\Documents and Settings\Administrator\Local Settings

> \Application Data\Microsoft\Windows NT\NTBackup\data\

>

> Rem This dir command will list all log files sorted by date in bare

> format

> set fcmd=dir "%fld%*.log" /OD /A-D /B

>

> Rem set command will set lastf variable to the last file in set, i.e.

> the latest one

> for /F "tokens=* delims= " %%i in ('%fcmd%') do set lastf=%fld%%%i

>

> Rem Mail latest log file to us

> c:\windows\system32\blat.exe "%lastf%" -t "recci...@mail.address" -s

> "Backup Report" -mime -server "smtp.XXX.org" -f

> "bkpserver@mailaddress" -q

>

> ========================

>

> Looks fine to me. I would probably simplify the following line somewhat.

> Instead of writing

> for /F "tokens=* delims= " %%i in ('%fcmd%') do set lastf=%fld%%%i

> I would write

> for /F "delims=" %%i in ('%fcmd%') do set lastf=%fld%%%i

>

> Note the missing space after the "=" sign.- Hide quoted text -

>

> - Show quoted text -

 

--------------------------------------------

That's great! Thanks!~

Since I just copy the sample from the internet, and I dont know how

does it run.

Would you mind example the coding for me?

 

for /F "delims=" %%i in ('%fcmd%') do set lastf=%fld%%%i

Guest Pegasus \(MVP\)
Posted

Re: ntbackup Alerts

 

 

"eWINg" <ewinglai@gmail.com> wrote in message

news:5d899419-6762-4d1b-8aed-9662b6cd71ed@u27g2000pro.googlegroups.com...

--------------------------------------------

That's great! Thanks!~

Since I just copy the sample from the internet, and I dont know how

does it run.

Would you mind example the coding for me?

 

for /F "delims=" %%i in ('%fcmd%') do set lastf=%fld%%%i

==============

OK, here we go.

 

- The command "for" sets off a loop.

 

- The "/F" parameter puts the loop into "advanced" mode.

 

- "The "delims=x" instructions says what delimiters should be considered

between each item in a list. Example:

for /F "tokens=1-3 delims=a" %a in ('echo supercalifragilistic') do echo

%a %b %c

will return the following when executed from a Command Prompt:

superc lifr gilistic

When you set "delims=" then there is no delimiter, hence the whold

list will be returned. Try it!

 

- "%%i" is the indexing variable. Use "%i" when running the command

from a Command Prompt.

 

- (...) The stuff inside the bracked is the list of things to be processed.

When enclosed in single quotes like so ('...') then it represents a

command

whose output will be the list of things to be processed.

 

- "set lastf=%fld%%%i": This is the command that gets executed once

each time you run through the loop. In this case you set the env. variable

"lastf" to a value composed of a previously set variable %fld%, appended

by the loop variable %i.

 

Most of it is advanced stuff that requires a bit of practice to comprehend.

The command "for /?", when executed at the Command Prompt, explains

all of it in a little more detail. Enjoy!

×
×
  • Create New...