Windows_task resource doesn't run pscp command

Hi partners,

I am trying to automate a file transfer. Then, I use windows_task resource to run this command:

pscp -pw password C:\\chef\\log* user@host:/path/to/load

However, the result of task says: “The system cannot find the file specified. (0x80070002)”, but if I manually create the task it works fine.

Some help pls.

Regards.

You probably need to either ensure that pscp is found in the native path that the system / task user runs as, or call it by the full path (c:\putty\pscp.exe or whatever).

Nathan Clemons
DevOps Engineer
Moxie Cloud Services (MCS)

O +1.425.467.5075
M +1.360.861.6291
E nclemons@gomoxie.com
W www.gomoxie.comhttp://www.gomoxie.com/

Hi @nclemons, I see that task is created by SYSTEM because I don’t specify a user. Why SYSTEM can not work with files, the same error happens when try to delete a file.

That’s a windows-specific question that I don’t really know the answer to; I primarily work on the Linux side of the house, but have been doing more on the IIS side lately in Chef (well, more helping other people with it than doing it myself), so I knew that Chef natively uses that account. I would think it should be the equivalent of root access on a Linux box, so I’m not sure what’s going on. I definitely expect you’ll need to specify the full path because of that user’s environment settings (more the lack thereof), but if you can’t delete a file, you have something wrong with your Windows ACLs and that’s not my forte.

Thanks for the information.