siriche has asked for the wisdom of the Perl Monks concerning the following question:

dear Monks, the following works like a charme when run on the command line of my Windows 7 box ---------------------------------
use Net::SCP; my $hostname = "myserver"; my $username = "myuser"; my $scp; $scp = Net::SCP->new({ "host"=>$hostname, "user"=>$username }); $scp->get("/my/remote/path/myfile.file", "mylocalpath/") or die $scp-> +{errstr};
--------------------------------- but when I add this to my task scheduler nothing happens. Tried several things (almost everything) with the syntax. Any idea/thoughts would be very much appreicated. Thanks S

Replies are listed 'Best First'.
Re: Net::SCP under Windows task scheduler failed
by syphilis (Archbishop) on Nov 13, 2013 at 11:03 UTC
    dear Monks, the following works like a charme

    Are you sure that your test script actually does anything ?
    It would be a rare feat if you've actually got Net::SCP to do anything useful on native Windows.

    I mean ... I can build, test and install Net-SCP-0.08 (and pre-requisites String-ShellQuote-1.04 & Net-SSH-0.09) on Windows without experiencing any problems. But that only happens because the test suites don't really test any functionality at all.

    Or are you running under Cygwin ? (That might improve your chances somewhat.)
    For "native" Windows you'll want to use the scp capabilities provided by the Net::SSH2 module.

    Cheers,
    Rob

      my test script works fine
      I run it on the Windows command shell and it does what it's suppose to do, i.e. scp a file from a remote unix server to my windows. That works fine.
      But I need this to run as a windows 7 task. And that does not work. I suspect being a problem with the ssh key. How can i force net::scp to use a specific id_rsa file? is there anything like -i "my_id_rsa_file" option?

      I haven't seen anything in that sense

      Maybe missed something.

        OK resolved !

        The task scheduler under Windows 7 has a tab "Actions"
        This tab has three fields
        The field 'Program/script:' is pretty obvious it should contain "perl"
        The field 'Add arguments' should contain the script "test.pl"
        And the field 'Start in' should contain the absolute path where your argument/file is,so in my case something like "D:\my\path\"

        To whom it may serve

Re: Net::SCP under Windows task scheduler failed
by Anonymous Monk on Nov 13, 2013 at 10:11 UTC
      The tasks scheduler logs say "Task Scheduler successfully finished:" Windows is self satisfied.

        The tasks scheduler logs say "Task Scheduler successfully finished:" Windows is self satisfied.

        And what do your logs say?