Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Possible to email the output of a (Server Job) script to me?

Created: 08 Mar 2011 | 7 comments

I have a task that I'm running on the main NS.  I'd like to be able to email the output of that task to myself.  However, I don't see any obvious way to save the script output and dump it into an email.  Is this possible?

Comments 7 CommentsJump to latest comment

mclemson's picture

Are you wanting to run a task and return the status/success/failure of that task to yourself?  Or is this a script that reports back a value to the NS?  Or..?

Mike Clemson, Senior Systems Engineer, ASC
Intuitive Technology Group -- Symantec Platinum Partner
intuitivetech.com

Zac H's picture

Its a batch file that returns a list of computer names from AD.  I need that list emailed to me.

mclemson's picture

I assume you're running this on the NS as a server job for the scheduling benefit of it all.  Would it be easier to rewrite the script so that it e-mails the results, and the NS continues to handle scheduling?

Or, if the data in AD is already in the NS, you could schedule the report to run against particular AD data already present in the NS.

But I can't think of a way to have the NS run a script which provides output to the NS which is then incorporated into an e-mail.

Mike Clemson, Senior Systems Engineer, ASC
Intuitive Technology Group -- Symantec Platinum Partner
intuitivetech.com

Rhys Paterson's picture

Store the output of the data into a custom inventory table. The setup an SQL report that displays the results, and then have an automation policy email the results of that table to you on a specified date/time.

We do it all the time!

(let me know if you need more information here, I'm just a bit busy at the moment)

Zac H's picture

Yeah, if you could get me more details on how to do that, that would be awesome!

Rhys Paterson's picture

.. and add it to the end of your script.

Unless you are doing it a different way? Let me know.

 'Variables
Set objEmail = CreateObject("CDO.Message")

strEmailFrom = "Notifications@NS7"
strEmailTo = "Your.Email@Workplace.com"
strEmailSubject = "Automated Report"
strEmailTextbody = "Test"
strEmailSmtpserver = "YourInternalSMTPServer"

'Create email message
objEmail.From = strEmailFrom
objEmail.To = strEmailTo
objEmail.Subject = strEmailSubject
objEmail.Textbody = strEmailTextbody
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailSmtpserver
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send

Set objEmail = Nothing