Video Screencast Help
Endpoint Management Community Blog

Send Email Notification to Tech After Completed Job

Created: 15 Jul 2009 • Updated: 16 Jul 2009 • 7 comments
Tenacious Geo's picture
+7 7 Votes
Login to vote

This little vbscript for sending an smtp message is useful to put as the last task of a Altiris Deployment Server job so that it emails the tech after the job has completed successfully.

The following DS variables are used:
%JOBUSER% -- the person who ran the job in Deployment Console
%NAME% -- the name of the computer in Deployment Console
%JOBNAME% -- the name of the job that was run in Deployment Console

In my version of this script, I have the "domain.com" portion in the From & To sections set to the domain of my organization. The Textbody section can have as much info as you want.

' Notify Tech when complete
'vbscript

' ===== Send Notification E-Mail =====
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "%JOBUSER%@domain.com"
objEmail.To = "%JOBUSER%@domain.com"
objEmail.Subject = "%JOBNAME% | %NAME%"
objEmail.Textbody = "Altiris Deployment Solution job: %JOBNAME% was run on computer: %NAME% by %JOBUSER%."
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"exchange1.umcaz.edu"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
' ===== Destroy Objects when Finished =====
Set objEnv = Nothing Set WshShell = Nothing

Edit: Someone found out this only works if you have security turned on in the console.

Comments 7 CommentsJump to latest comment

Palvaran's picture

I gotta say, this is one of the best ideas I have seen for DS in a long time.  Excellent idea so that when we que up jobs, work on something else, and know when to come back and check out and continue our work when we upload an image, deploy a package, run a script, etc.  A++++

Systems Administrator
Rice University

Remember, "The happiness of your life, depends on the quality of your thoughts."

+1
Login to vote
Tenacious Geo's picture

I am glad it's useful to you. We've had it so long that I can't remember whether I found it on an Altiris site/forum, or if I ran across the vbscript on the intertubes and thought it would be a good fit for DS... either way it helps a lot. We use it either just to let the tech know that their job is done (such as an image job), or if it's an application install that requires post-install tweaking, they get a reminder to do that.

-Geo

-2
Login to vote
lah's picture

The script doesn't work for me because the %JOBUSER% variable is empty. The other varibles contains values, but %JOBUSER% returns nothing. What am I doing wrong?

EDIT: Nevermind. I had to enable security in the Deployment Console.


+1
Login to vote
MBHarmon's picture

A warning on this, if you use a Job to spawn another Job containing this file the %JOBUSER% variable may not be set even if you are currently using Security.

- Matt

+1
Login to vote
Tenacious Geo's picture

Ah, interesting point. We don't do any 'job spawning' (LOL), but it makes sense.

-Geo

-1
Login to vote
dfnkt_'s picture

 Was anyone able to use %DSServer% in the from line? My email arrived with %DSServer% still as the "From". 

-1
Login to vote
michael cole's picture

I've attempted to reproduce an alternative for DS 7.1/ITMS and above here: https://www-secure.symantec.com/connect/articles/emailing-user-job-completion-smp-71 in an article where I create the token required. It is pending release at the time but i'll forget if i wait any longer.

There reason i'm posting on a very old thread is because searching still provides this result but to the wrong product if you wanted the solution for ITMS/CMS etc.

Michael Cole

Principal Business Critical Engineer

Business Critical Services

-1
Login to vote