MAPI is not working from task scheduler

MAPI is not working from task scheduler

MAPI is not working from task scheduler

HI, I've a simple batch file which calls the below vbs script to send email using MAPI. I've scheduled the batch script through windows scheduler and it's working fine when I set the task as "Run only when user is logged on". I manually run the job from task scheduler, and I get email everytime I run it. Also I'm one of the Administrators on this server.

However when I set the task as "Run whether user is logged on or not", it invokes the batch file, however it never finishes. I run this manually from task scheduler and it never gets completed. After debugging I find that, it's stuck on the below line, it seems like it can't open outlook when running as "Run whether user is logged on or not". Set ol = WScript.CreateObject("Outlook.Application")

I tried all the options, security, start in, priority etc., but nothing worked. Will it ever work with MAPI while "Run whether user is logged on or not" option is set or will I have to use CDO to resolve this issue? I need to make this work when we logged off from the server so that it monitors 24 hours and sends email when there is an error in server. Thanks!

RE: MAPI is not working from task scheduler

when I check the event viewer in server after running the task with "Run whether user is logged on or not" option, I see application error with the below details:Faulting application OUTLOOK.EXE, version 12.0.6423.1000, time stamp 0x49b08185, faulting module OUTLOOK.EXE, version 12.0.6423.1000, time stamp 0x49b08185, exception code 0xc0000005, fault offset 0x0000bfad, process id 0x2ccc, application start time 0x01cd12929c2c4f79.