The last step you need to take is to put the backup script on a schedule. You can do this by going to your Control Panel, and clicking 'Scheduled Tasks'. Then click 'Add scheduled Task'.
When the first screen of the wizard pops up, click 'Next'. The wizard will present you with a long list of programs you can choose from. Just click 'Browse', and find the Backup.vbs file that you created. Choose the schedule you wish (I run mine twice weekly). You may need to supply credentials, the username and password under which the task will run. You will need to supply administrator level permissions, or better yet 'Backup Operator'. If you only supply user level permissions, the script will more than likely fail.
This is an extremely useful way to automate your backups. As I mentioned in the outset, you could simply use ntbackup and the scheduler, but this will more than likely be insufficient for your needs, as it was for mine. Every so often it's a good idea to burn the backup file to CD, or whatever other means external storage you have. I hope this script will make your life as easy as it has mine! Here's the full script:
Dim objShell, objFSO, thisDir, bksFile, bkfFile, strBackup, strLogFile, objWrite
dim objFile, secondDrive, doCopy, strOutlook
set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objShell = CreateObject( "Wscript.Shell" )
thisDir = objFSO.GetFolder( objFSO.GetParentFolderName( WScript.ScriptFullName ) ) & ""
bksFile = "backup.bks"
bkfFile = "backup.bkf"
strBackup = "ntbackup backup ""@" & thisDir & bksFile & """ /f """ & thisDir & bkfFile & """"
strLogFile = "backup_log.txt"
strOutlook = """C:Program FilesMicrosoft OfficeOffice10OUTLOOK.EXE"" /recycle"
secondDrive = "f:bkp"
doCopy = true
'=== close Outlook
objShell.Run strOutlook
wScript.Sleep(4000)
objShell.AppActivate( "outlook" )
wScript.Sleep(4000)
objShell.SendKeys( "%{F4}" )
'=== perform backup
objShell.Run strBackup, 1, true
'=== log backup
If Not objFSO.FileExists( strLogFile ) Then objFSO.CreateTextFile( strLogFile )
set objWrite = objFSO.OpenTextFile( strLogFile, 8 )
Set objFile = objFSO.GetFile( thisDir & bkfFile )
objWrite.WriteLine( Date() & " - backup file is: " & objFile.Size & " bytes")
objWrite.Close()
'=== copy backup file
if doCopy then objFile.Copy secondDrive, True
'=== cleanup
Set objShell = Nothing
Set objFSO = Nothing
Set objWrite = Nothing
set objFile = Nothing
msgBox( "Backup Successful " & date() )
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |