Recently I was debugging why a backup of a QuickBooks file was not working. A scheduled job running on the server was supposed to create a compressed encrypted version on a removable USB drive. The job was written by someone else and I guess they never checked to see if it worked!? I found that itt worked when I ran it interactively but it failed when I ran it as a schedule job. It took me a while to figure this problem out but the QuickBooks folder was actually a shared folder on another computer and the drive mapping was not available in the batch environment. To fix the problem I added the following statements to create a drive mapped as ‘r:’.
Dim objNetwork Set objNetwork = WScript.CreateObject("WScript.Network") strLocalDrive = "r:" strRemoteShare = "\\myserver\Backups_Daily" objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, False