Solved

Send email using a Scheduled Task thats attached to an Event ID using Windows Server 2008 R2 Standard?

Posted on 2010-08-20
3
2,801 Views
Last Modified: 2012-05-10
I'm creating a Basic Task using the Wizard, and then attaching that task to the Scheduled Task.  I want to receive an email when the event is logged.  I'm not getting the email.  Under the the History Tab I see it failed with this msg.  IIS 7.5 is running, I don't see the smtp service running if that matters.

Would somebody clue me in on what I need to do to make this happen?  

+ System

  - Provider

   [ Name]  Microsoft-Windows-TaskScheduler
   [ Guid]  {DE7B24EA-73C8-4A09-985D-5BDADCFA9017}
 
   EventID 202
 
   Version 0
 
   Level 2
 
   Task 202
 
   Opcode 102
 
   Keywords 0x8000000000000000
 
  - TimeCreated

   [ SystemTime]  2010-08-20T19:45:05.048062300Z
 
   EventRecordID 14231
 
  - Correlation

   [ ActivityID]  {3EF22033-2BA7-4A10-A450-382187D033B7}
 
  - Execution

   [ ProcessID]  6016
   [ ThreadID]  6384
 
   Channel Microsoft-Windows-TaskScheduler/Operational
 
   Computer name.mydomain.org
 
  - Security

   [ UserID]  S-1-5-21-32063543-1347908593-1251826310-500

- EventData

  TaskName \Event Viewer Tasks\System_Microsoft-Windows-WAS_5186
  TaskInstanceId {3EF22033-2BA7-4A10-A450-382187D033B7}
  ActionName Sys Evt Log Info event id5186 ComputerName
  ResultCode 2147746323
0
Comment
Question by:mobot
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
SylvainDrapeau earned 500 total points
ID: 33489026
Hello !

Judging by the following link, you may never correct your problem : http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/Q_24474964.html

No one ever found a solution for this problem, which is really, really similar to yours.

I would go with a workaround. Set up your task to launch a batch file instead of send an email and get your hand on the "sendemail.exe" command line email sender (see here : http://caspian.dotconf.net/menu/Software/SendEmail/). You can then pass parameters to your batch file to personalize your message. I works great, I've been using this for years. This should solve your problem.

Syldra
0
 

Author Comment

by:mobot
ID: 33489381
Syldra hi - I read that post before I posted, he's using the Small Business Server, and I'm using Standard, so I was hoping that might make a difference.  I just have to laugh a bit here.  Microsoft should have made this tool available years ago.  Now they have it, and it don't work, I should know better by now.  It may be Monday before I get back to this one.  

I've just started digging into Powershell, and using the send-mailmessage cmdlet.  I've got the script running from within Powershell, from the Run box, and from the DOS shell cmd line, and it works.  Now I'm trying to make it work as a task from for a user defined Data Collector Set.  The basic if the cpu spikes above this limit send me an email.  Your idea of a batch file will probably work for that too.

On the Windows 2003 servers, I've got a little vb script that I run from a batch file, cscript sample.vbs that does this for us.  I tried it on 2008 and it flakes out so I started down the Powershell road.

Thanks
0
 

Author Closing Comment

by:mobot
ID: 33495510
Many thanks, the batch file does solve the problem.  I get an email when the event is triggered.  

Hope this helps somebody else.

rem - 1 line powershell script, named sendemail.ps1
send-mailmessage -to "serveradmin@domain.org" -from "server@domain.org" -subject "Test Mail" -body "Check server" -smtpserver.domain.org

rem - 1 line batch file to run the script.
powershell.exe c:\myscripts\sendemail.ps1

From within Powershell for help.
get-help send-mailmessage -examples
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
Redirected folders in a windows domain can be quite useful for a number of reasons, one of them being that with redirected application data, you can give users more seamless experience when logging into different workstations.  For example, if a use…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now