When trying to ssh to OpenSSH running on Windows cron is not working
However if you run the script manually it executes correctly. After days of research and asking everyone I know I finally stumbled across a solution which fixes the problem.
This whole conundrum occurred after my excitement of OpenSSH being released for Windows which I thought would make things much easier to manage all my servers from a single node in a scripted manner.
WinSCP has a great guide on installing it in Windows below:
https://winscp.net/eng/docs/guide_windows_openssh_server
Originally I has several jobs scheduled in cron that all depended on the previous one to finish before it starts as well as scheduled tasks on Windows machines that had the same prerequisites. Since I had to make many modifications across the board I decided to just chain everything together in a more organized fashion.
I made a script which calls other scripts to automate some processes and everything worked great when manually testing from the command line. I scheduled it in cron and that’s when everything stopped working.
My design is simple where using ssh keys from a single Linux server acting as a “master node” to execute stuff locally and then execute local scripts on multiple remote servers via SSH. This flow would be run across multiple flavors of Linux as well as ssh’ing to Windows.