Link to home
Start Free TrialLog in
Avatar of drotkopf
drotkopfFlag for United States of America

asked on

NTBACKUP in Command Line to backup only Exchange

Hi,

I have SBS 2003 and I want to write an NTBACKUP command line so I can schedule to backup Exchange's Microsoft Information Store daily.

I don't mind overwritting the exising .bkf file everytime since it will be backed up daily online.

Please, don't direct me to how to articles, just give me the command.

Thanks!

Dan
Avatar of tmeunier
tmeunier
Flag of United States of America image

To where will you be backing it up?  Tape or fixed disk?
Avatar of drotkopf

ASKER

Fixed Disk. Let's say the folder is C:\Backups\Exchange
SOLUTION
Avatar of rindi
rindi
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oh sorry, that script maps a network drive X:  to share \\fileserver\exchangebackup.  You can remove that part if fixed disk.

-tom
rindi:  
    I couldn't find what I was looking for in http://www.lwcomputing.com/tips/static/backup.asp

tmeunier:
    I don't need to rotate. I want to overwrite yesterday's file with today''s backup. That's because yesterday's file was copied to a remote location already. I'm looking for as much simplicity as possible as this place is not run by techs.

Thanks.
Did you check the 2nd link I posted? You can also find it within the first Link under "Scripts". It'll direct you to download the script which leew made.
------------------------------------------------------------
C:\backups\ExchangeBackup.cmd
------------------------------------------------------------
@Echo off
:: Delete existing Exchange Full backup
ECHO Y| DEL "C:\BACKUPS\EXCHANGE\Exchange full.bkf"

:: Backup command line
ntbackup.exe backup "@C:\BACKUPS\EXCHANGEFULL.bks" /d "Daily full Exchange backup" /v:no /r:no /rs:no /hc:off /m normal /j "Daily Exchange Full" /l:f /f "C:\BACKUPS\EXCHANGE\Exchange Full.bkf"

:: Move job logs to C:\backups\ & name  "Exchange backup date-time.log"
move "C:\Documents and Settings\username\local settings\application data\microsoft\windows nt\NTBackup\data\*.log" "c:\backups\LOGS\Exchange Backup.log"

exit

:::::  NOTE that the \username\ portion of the move-job-logs line will be the user that you're using to run the script.  

------------------------------------------------------------
C:\backups\exchangefull.bks
------------------------------------------------------------
JET YOUR_SERVER_NAME\Microsoft Information Store\First Storage Group\
By the way, Lee Wilbur's script is most awesome.  And pay no attention to the comments lines in the little batch script I posted; I didn't clean them up for your purposes.

-tom
Thanks guys. I'll try this one later tonight.
Hi,

I'm running the script below, and it seems to start ok, but after 20-30 seconds it aborts and says it can't find the path.

@Echo off
:: Delete existing Exchange Full backup
:: ECHO Y| DEL "C:\BACKUP\EXCHANGE\ExchangeFull.bkf"

:: Backup command line
ntbackup.exe backup "C:\BACKUP\EXCHANGEFULL.bks" /d "Daily full Exchange backup" /v:no /r:no /rs:no /hc:off /m normal /j "Daily Exchange Full" /l:f /f "C:\BACKUP\EXCHANGE\ExchangeFull.bkf"

:: Move job logs to C:\backups\ & name  "Exchange backup date-time.log"
move "C:\Documents and Settings\administrator\local settings\application data\microsoft\windows nt\NTBackup\data\*.log" "c:\backup\LOGS\Exchange Backup.log"

::exit

Also, it seems to be backing up something in C: and not the Info Store:

untitled.JPG
1.  Create C:\BACKUP.  WInthin that create C:\BACKUP\EXCHANGE and C:\BACKUP\LOGS
2.  That script should be saved as C:\BACKUP\ExchangeBackup.cmd
3.   You should also create the file C:\BACKUP\ExchangeFull.BKF which includes the single line:
      JET YOUR_SERVER_NAME\Microsoft Information Store\First Storage Group\

This is the configuration file that is referenced in the script, which tells NTBackup which file selections to run.  The fact that it is selecting C: rather than YourServername | Info Store | First Storage Group is indicative that this file doesn't exist, or is mis-named, or something like that.

-tom
I was missing the logs directory!

When you say "3.   You should also create the file C:\BACKUP\ExchangeFull.BKF which includes ..."
you mean .bks, right?

I do mean .bks, yes.
Hi,

This is how the file looks after a couple of other fixes:


@Echo off
:: Delete existing Exchange Full backup
:: ECHO Y| DEL "C:\BACKUP\EXCHANGE\ExchangeFull.bkf"

:: Backup command line
ntbackup.exe backup "C:\BACKUP\EXCHANGEFULL.bks" /d "Daily full Exchange backup" /v:no /r:no /rs:no /hc:off /m normal /j "Daily Exchange Full" /l:f /f "C:\BACKUP\EXCHANGE\ExchangeFull.bkf"

:: Move job logs to C:\backups\ & name  "Exchange backup date-time.log"
move "C:\Documents and Settings\administrator.TECHINT\local settings\application data\microsoft\windows nt\NTBackup\data\*.log" "c:\backup\ExchangeLogs"

::exit


Now, the backup file is a mere 10K big. I think it's what I mentioned before. Look at my screenshot. It's not backing up the inf store but something (really, nothing) in C:

This is a log file:

Backup Status
Operation: Backup
Active backup destination: File
Media name: "ExchangeFull.bkf created 8/9/2009 at 9:38 PM"

Volume shadow copy creation: Attempt 1.
Backup (via shadow copy) of "C: "
Backup set #1 on media #1
Backup description: "Daily full Exchange backup"
Media name: "ExchangeFull.bkf created 8/9/2009 at 9:38 PM"

Backup Type: Normal

Backup started on 8/9/2009 at 9:39 PM.
Backup completed on 8/9/2009 at 9:39 PM.
Directories: 0
Files: 0
Bytes: 0
Time:  1 second

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


Thanks,

Dan
This is sort of bizarre.  I'm getting the same behavior.  Here's how I fixed it, and I have to admit I'm not going to screw with it because I'm lazy, but:

My ExchangeFull.bks file does this, when created in Notepad.  But when I create the same thing in NTBackup, by making the selections in the GUI - selecting the information store - and then say file > Save as and I save it as C:\Backup\ExchangeFull.bks, THAT one works.  The other strange thing is that when I type it in notepad, it's 59 bytes, but when I create it in NTBackup and save it, it's 122 bytes.  To look at them in notepad, they're identical.  

So, I have to throw up my hands and say, try running the GUI once, selecting your Info Store, and select Job > Save Selections As > c:\backups\exchangefull.bks.  Then try again.  For me, it worked.
Will try that. Thanks.
It didn't help.
Hi,
I just scheduled it using NTBACKUP's gui and it's working fine.
Thanks!