Listing 1: NT Backup Routine to Automatically Name Log Files With the Current Date and Time :: Revisions: :: 08/22/01: This revision has additions to accommodate Microsoft Small Business Server :: 4.5. SBS 4.5 requires a special procedure to stop and start the Microsoft ;; Exchange POP3 Connector service. For additional information, see the Microsoft articles ;; “Error Message When You Use ‘Net’ Command with Microsoft Exchange Connector ;; for POP3 Mailboxes” (http://support.microsoft.com/support/ kb/articles/q257/6/89.asp), :: and “XADM: Start and Stop Exchange Services from a Command Line” ;; (http://support.microsoft.com/support/kb/articles/q160/5/72.asp). :: Note: Sc.exe is available in the Microsoft Windows NT Server 4.0 Resource Kit. :: Note: Aintx.zip is available at http://user.mc.net/~jlh/ nttools/html/download_aintx.htm. :: Stop Exchange net stop MSExchangeMSMI /y net stop MSExchangePCMTA /y net stop MSExchangeFB /y net stop MSExchangeDX /y net stop MSExchangeIMC /y net stop MSExchangeMTA /y net stop MSExchangeIS /y net stop MSExchangeDS /y net stop MSExchangeSA /y :: The following line is necessary only for SBS 4.5. It requires sc.exe. sc stop mspop3connector :: Create the Date environmental variable. Requires ntdate.exe. :: Aintx.zip contains ntdate.exe and other UNIX-like utilities for NT. set DayOfWeek= set Month= set Day= set Year= set Hour= set Minute= set Second= set Date= for /f "tokens=1-7 delims=: " %%i in ('ntdate') do ( set DayOfWeek=%%i set Month=%%j set Day=%%k set Year=%%l set Hour=%%m set Minute=%%n set Second=%%o set Date=%%i %%j %%k %%l %%m %%n %%o ) :: Here's the backup code: :: Here's the Full Backup code: ntbackup backup C: D: /v /b /hc:off /t normal /d "Full Backup of drives C and D" /l "c:\bkup-log\FB %Date%.log" /e /tape:0 :: Here's the Daily Backup code: ntbackup backup C: D: /a /v /hc:off /t incremental /d "Daily Backup of drives C and D" /l "c:\bkup-log\DB %Date%.log" /e /tape:0 :: Restart Exchange net start MSExchangeSA net start MSExchangeDS net start MSExchangeIS net start MSExchangeMTA net start MSExchangeIMC net start MSExchangeDX net start MSExchangeFB net start MSExchangePCMTA net start MSExchangeMSMI :: The following line is necessary only for SBS 4.5. It requires sc.exe. sc start mspop3connector :: Alert a user that the Full Backup has finished. net send Administrator Full Backup Finished. :: End