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

Job to Check Service State and Send Alert

Created: 03 Sep 2012 • Updated: 06 Sep 2012 | 10 comments
This issue has been solved. See solution.

I'm trying to make a job that checks a windows service state and sends an email if it isn't 'running'. The service state check is OK using existing tasks but I can't figure out the email side. Whenever I choose to add an existing task the email tasks are not shown. What's the best way to achieve this please?

Comments 10 CommentsJump to latest comment

BugTastic's picture

I have CMS V7.0 - For some reason (that I cant understand) You can only add a send email task to a server job, not a client job. You could try that!

Joe.

ukDavidC's picture

Thanks, the problem then is that you can't run that server task on the clients. I guess the clients themselves dont have an email capability but I was hoping it would be able to relay it via the server or something?

Please don't forget to mark your thread solved with whatever answer helped you : )

ukDavidC's picture

If I create a server job, it doesn't give me the option to 'quick run' against a client, only schedule it. The job needs to check the service (on every client) and send an email alert if it isn't running...

Please don't forget to mark your thread solved with whatever answer helped you : )

SaschaH's picture

How time critical is it? Does it really need to run immediatelly? Rather build a automation policy with an SQL query for the service state. It gets reported by basic inventory.(standard basic inventory schedule is 1 day) So if you want to have it more immediate do the following.

Just build a client job, first sending a task to the client to send the basic inventory ASAP.
Second use one of the ASDK sample scripts to trigger the automation policy. Put this script in an task server task, this way it can be run in the client job. Just remember if you have other task servers then your NS you will need to install the ASDK components on it.

Bechtle – your strong IT partner. Today and tomorrow

If that seems to help, please "Mark as Solution"

SOLUTION
JMP51483's picture

You could also utilize a power shell / vbscript on the local machine to check the service and then send an email from the client itself. The email wouldn't come directly through the console but it should still obtain what you're looking for.

JCMR Technology - Charlotte, NC
Symantec Platinum Partner

ianatkin's picture

The above post from JMP51483 is the approach I'd instinctively use here.

Ian Atkin, IT Services, Oxford University, UK

Connect Etiquette: "Mark as Solution" those posts which assist you most in resolving your problem, and give a thumbs up to useful articles and downloads

BugTastic's picture

Not much at scripting.. anyone got a script that would do this ?

BugTastic's picture

Found a script that does this in case anyone needs it. :

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "altiris Build Job Completed"
objMessage.From = "from address@here.com"
objMessage.To = recipient@here.com
objMessage.TextBody = "Build Completed"

 
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "EXCHANGESERVER"
'objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoNTLM
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "domain\username"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update

objMessage.Send

ukDavidC's picture

Thanks for your suggestions, I guess I would prefer server based just to remove the need for the clients to have to authenticate against email servers etc.. It isn't time critical so I'll check out the server method first!

Please don't forget to mark your thread solved with whatever answer helped you : )