Thanks to Steven Manross, I'm a step further along in troubleshooting this.  
Using Steven's suggestion, I got the following from OLE->LastError: 
'Win32::OLE(0.1403) error 0x80070005: "Access is denied"'.  Does anyone out 
there know anything about how the Win2k scheduler accesses objects (and, more 
importantly, how to circumvent this problem)?  As I stated earlier, the 
scheduled task is running under the same userid I use to log on when I 
successfully run my program at a command prompt.

Ken
-----Original Message-----
From: Steven Manross [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 03, 2006 5:18 PM
To: LeFevre, Ken; perl-win32-users@listserv.ActiveState.com
Subject: RE: Win32::Ole (MAPI) and Win2K scheduler


Replace :

die "Oops, cannot start Outlook";

with 

open (FILE,">>c:\\outlookerror.txt");
print FILE "Oops, cannot start Outlook\n".Win32::OLE->LastError();
close (FILE);
die "Oops, cannot start Outlook";

It will help refine what error the script is throwing (and refine the
possible solutions to the problem).

Steven
________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
LeFevre, Ken
Sent: Tuesday, January 03, 2006 1:01 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Win32::Ole (MAPI) and Win2K scheduler


I created a program using ActiveState's perl 5.8.4, compiled it using
perlapp 5.3.0 and ran it on Windows 2000 Professional SP4 against
Outlook 2000 SR-1 (9.0.0.3821).  It runs properly both from a command
prompt and as a scheduled task.  I released it into production on
Windows 2000 server SP4 using the identical version of Outlook 2000.
Again, it runs great from a command prompt.  When I run it as a
scheduled task, however, it dies because it's not able to get the
Outlook Application.
 
Here's the relevant code:
 
 
    Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE); 
        die Win32::OLE->LastError(),"\n" if Win32::OLE->LastError(  );
    eval { $Outlook = Win32::OLE->GetActiveObject('Outlook.Application')
};
        die "Outlook is not installed" if $@;
    unless (defined $Outlook) {
        $Outlook = Win32::OLE->new('Outlook.Application', sub
{$_[0]->Quit;});
            or die "Oops, cannot start Outlook";
<======================= dies here under Win2k srvr as a scheduled task
 
As best I can tell, Outlook is registered the same on both machines.
The same dlls exist on both.  I even set up the scheduled task to run
under the same userid I used when logging on to the server to run the
program from the command prompt.  My theory is that there is some sort
of permissions issue or a difference in the scheduled task environment
between the two versions of the Win2k OS, but I'm not succeeded at
finding the problem and how to resolve it.
 
I would greatly appreciate any insight or assistance in getting this to
run in the new environment.
 
Thanks,
 
Ken

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to