RobK Posted October 2, 2007 Report Share Posted October 2, 2007 I have a vbs script that uses CDO to send an email. It is used to send reports for a bunch of robocopy jobs that run overnight. The problem is that if several jobs finish at the same time some of the emails do not get sent. Does anyone know why this happens? I suspect it's to do with several instances of the script trying to access the CDO dll at the same time, but I don't know how to get around it. Link to comment Share on other sites More sharing options...
Mac Posted October 2, 2007 Report Share Posted October 2, 2007 Is it on the same machine mate? You can stick wait states in to wait until CDO is finished its current task before accepting another. Post up the script or email it to me - zipped & password'ed so it'll get through our filters. Link to comment Share on other sites More sharing options...
RobK Posted October 2, 2007 Author Report Share Posted October 2, 2007 Here's the relevant portion of the script: <font class="small">Code:</font><hr /><pre> Set objEmail = CreateObject("CDO.Message") objEmail.From = "[email protected]" objEmail.To = "[email protected]" objEmail.Subject = "replication errors" objEmail.Textbody = "The replication service encountered the following error(s):" & vbCRLF & vbCRLF &"Robocopy result code: " &return & vbCRLF & vbCRLF &strroboerr & vbCRLF & "Please check the log file." objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "mail" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.AddAttachment errlogfile objEmail.Send End Sub</pre><hr /> Multiple instances of this script are called by a master script so it is running up to 40 or so copies at the same time. I end up losing about 20% of the report emails. Link to comment Share on other sites More sharing options...
Mac Posted October 2, 2007 Report Share Posted October 2, 2007 That script is fine - could the sub scripts not be being called properly/not starting? Try starting them in their own VM? Link to comment Share on other sites More sharing options...
RobK Posted October 2, 2007 Author Report Share Posted October 2, 2007 Everything works fine on its own, it only when there are lots running at once that there are problems. BTW did you read my PM about Citrix? Link to comment Share on other sites More sharing options...
Mac Posted October 2, 2007 Report Share Posted October 2, 2007 That's my point - it could be the number of wscript shells running? PM About Citrix? Ummm, no? Sorry, will have a look see Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now