We have a vbs file on our local server (A) that uses mapnetworkdrive to contact two servers at a remote location (B) and copy files from B to A. The script has been running for about 3 months with no problems. Since last week, the script has been unable to map the network drive to B if it runs from Task Scheduler, but it works fine when run from the command line or by double-clicking on the vbs file.
I know the script is running because it logs things as it runs. One of those is the error message when it tries to map the network drive. It looks like this:
boh_mapped_drive_letter = "w:"
boh_mapped_drive = "\\xxx.xxx.xxx.xxx\sharename"
NetworkObject.MapNetworkDrive boh_mapped_drive_letter, boh_mapped_drive, False, <username>, <password>
if err.number <> 0
appendToFile logfile, vbtab & "error occurred - " & vbtab & err.number & " " & err.source & " " & err.description
Err.Clear
end if
and the error I get is:
53 Microsoft VBScript runtime error File not found
What could cause the scheduled task to not be able to map the network drive but it still works by manually executing it?
When you double-click or CLI execute a vbs file, what user account does it run under? Is it different from the user account that runs it from Task Scheduler?