Login to participate
Endpoint Management & Virtualization BlogsRSS

Send Email Notification to Tech After Completed Job

George Wagner's picture

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.

Palvaran's picture

Brilliant!

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++++

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

George Wagner's picture

I am glad it's useful to you.

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

Don't forget to mark the solution to your forum post if it has been answered!

lah's picture

%JOBUSER% variable is blank

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.


MBHarmon's picture

A warning on this, if you use

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

George Wagner's picture

Ah, interesting point. We

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

-Geo

Don't forget to mark the solution to your forum post if it has been answered!

dfnkt_'s picture

 Was anyone able to use

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