Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Local backup - using robocopy and scripting

Posted on 2010-09-17
4
Medium Priority
?
611 Views
Last Modified: 2012-05-10
Hi all,

I have put together a script that will run a robocopy job, then create a log file based on the date and time the job completed. I want to know if there is a way to interigrate this log file on completion and then if there are errors send an email with the errors included. If the job has no errors then send an email with backup was successful.

Does anyone know how this could be done?

thanks
0
Comment
Question by:ranski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:simonseztech
ID: 33701021
Have a look herehttp://www.petri.co.il/send_mail_from_script.htmYou can use exit code of robocopyhttp://blogs.technet.com/b/deploymentguys/archive/2008/06/16/robocopy-exit-codes.aspxIf you have little budget for around 20 box you will gethttp://www.robocopyplus.com/     RoboCopyPlus adds the following functionality to    Microsoft ROBOCOPY:        * Email notification on 'Success', 'Warnings' or 'Errors'.        * Log file filtering, showing only relevant information, like warnings, errors and other exceptions.        * Smart logfile attachments, e.g. on warnings or errors only.Hope it help.
0
 

Author Comment

by:ranski
ID: 33702017
thanks, any idea how to get the below script to point a link to the latest log file rather than attach it?
 

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("c:\log\")
datNewest = #1/1/1970#
For Each objFile In objFolder.Files
  If objFile.DateLastModified > datNewest Then
    datNewest = objFile.DateLastModified
    objNewest = objFile
  End If
Next
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "test@test.com"
objEmail.To = "test2@test.com"
objEmail.Subject = "Backup"
objEmail.Textbody = "check the attached log file.(objNewest)" 
objEmail.AddAttachment objNewest
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.test.com"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
objEmail.Configuration.Fields.Update
objEmail.Send

Open in new window

0
 
LVL 7

Accepted Solution

by:
simonseztech earned 2000 total points
ID: 33703701
You mean something like this ?
objEmail.Textbody = "Check this  <a href="c:\log\(objNewest)">link</a>"
0
 

Author Closing Comment

by:ranski
ID: 33906302
thanks
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question