Hello monks,

For about a year, I've been running a script that uses Win32::OLE and CuteFTP's Transfer Engine. The pertinent part of the script begins like this:

use Win32::OLE qw(in with); use Win32::OLE::Const 'CuteFTPPro'; my $ftp = Win32::OLE->new('CuteFTPPro.TEConnection', 'Close') or die "Error: Can't create FTP object: $!"; print "FTP object created, continuing...\n";

This script runs unattended on a Windows 2000 machine, using Task Scheduler, running in the context of a service account I set up for this purpose. I have a new project that requires something similar, so I borrowed a bunch of this code from the working script.

My new script is complete, and runs fine when I run it manually from a command prompt, logged in as my service account. The problem is, the script hangs at this point when I run it unattended from Task Scheduler. The my $ftp = line never finishes: it doesn't print the die error, nor the following print statement. (I'm piping the output to a logfile, so I can see exactly where it hangs.) It will hang at this point until I kill the task.

I'm at a loss to explain it, and I can't figure out how to troubleshoot this. I don't have much visibility into the process when it's running as a scheduled task, so I don't know where to go with this. Does anyone have guesses as to what might be going on, or how to narrow it down? Any ideas would be appreciated - thanks!


In reply to Can't create Win32::OLE object by EyeOpener

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.