I am a long time reader of AskWoody newsletters. Now I need some help. I help a small non-profit with their tech work. All computers are running Windows 10 Pro version.
A disk image is created every two weeks for each computer. The destination drive for the disk image is a USB connected external hard drive. Once the image file has been created it is later copied across the network to a network shared external drive on another PC. All this works well.
I run a batch file on the source PC that does basically two things: 1. copies the file to its destination; 2. lists a directory of the source folder where the backup file was created and the list the directory for the destination folder where the file was copied to. The batch file output is appended to a log file. I do this to monitor that all files are current and monitor disk space.
Since I primarily work remotely I have all the above batch file actions output to a log file which is then emailed to me.
Here’s the rub. Everything works fine (been using this method for many years with no problems) except the line to list the network share directory does not produce the directory listing. The directory listing for the (local) attached USB drive is listed fine. And there’s a gotcha here…when I run the batch file from the folder where it resides (e.g., …username\documents\backup-stuff\) the network share directory (destination) is listed correctly. But I run this batch file in the Task Scheduler and when it’s completed there is no directory listing for the shared drive, only the local attached external drive.
This is a new problem because I used to use a network share as the destination for the disk images but have changed to local attached USB external drives on each PC because of problems that have developed after a disk image software upgrade. What is Task Scheduler doing that causes the network share directory listing to not appear in the log file but it does show up when I just run the batch file?