The local Windows account, you are running your scheduled task with, does not have an access to that shared drive.
This most likely has nothing to do with WinSCP. Try running a regular batch file with
dir \\SHARE instead of WinSCP. You should get the same behavior.
I'm troubleshooting a scheduled task that was created to sync certain files from the remote directory to the local directory. The local directory is a network share. In the script, when it is ran manually, it will work just fine. If I set the task to run at night and log off, the log shows that when WinSCP tries to reach the share, it can't find it. This task is running on a Windows 2016 server. This same task is also running on a 2008 R2 server without issues; it just seems to be the 2016 server. The antivirus logs doesn't show anything. I don't see any errors or issues logged in Windows. I've attached the script. Below are specs and a copy of the error from the log WinSCP output. I removed the actual share name; it's filled in correctly in the script. The script is called from a batch file.
WinSCP Version: 5.13.4
Windows Server 2016
> 2018-11-13 10:41:01.259 Script: lcd \\SHARE
> 2018-11-13 10:41:01.259 Script: Parameter: \\SHARE
< 2018-11-13 10:41:01.341 Script: Error changing directory to '\\SHARE'.
< 2018-11-13 10:41:01.342 System Error. Code: 64.
< 2018-11-13 10:41:01.342 The specified network name is no longer available
. 2018-11-13 10:41:01.342 Script: Failed