Windows computers will disconnect a mapped drive after a period of time. Because of this a scheduled task .bat that calls an executable on a mapped drive will not run and the scheduled task will hang.
Place the below code in a .bat file which will be called from the scheduled task. The code will disconnect the mapped drive and then remap and connect. After that the code will go to the path of the .exe and then run that exe.
Net use g: /delete
Net use g: \\servername\folder