JAW
2009-11-04 18:02:13 UTC
I have a script that at the end must copy a file from one server to
another server.
I mapped a network drive via NET USE and saved the credentials and it
works great!
However, when I run the job (using the same account) as a scheduled
task the copy fails. It works fine on a local drive but not on a
networked driver. I get a 76 return code from the the copy.
Below is the area of the code that fails.
' FTP good backup copy and check for success
Const OverwriteExisting = TRUE
objFSO.CopyFile v_backup,v_xbackup,OverwriteExisting
objFSO.CopyFile v_output,v_xoutput,OverwriteExisting
v_returncode = err.number
If v_Returncode = 0 then
WScript.echo "FTP return code =" & v_ReturnCode
Else
WScript.echo "FTP return code =" & v_ReturnCode
WScript.echo "FTP command errored out"
Call emailer
v_msg = "Process Completed: " & time
WScript.Echo v_msg
Wscript.Quit 1
End If
another server.
I mapped a network drive via NET USE and saved the credentials and it
works great!
However, when I run the job (using the same account) as a scheduled
task the copy fails. It works fine on a local drive but not on a
networked driver. I get a 76 return code from the the copy.
Below is the area of the code that fails.
' FTP good backup copy and check for success
Const OverwriteExisting = TRUE
objFSO.CopyFile v_backup,v_xbackup,OverwriteExisting
objFSO.CopyFile v_output,v_xoutput,OverwriteExisting
v_returncode = err.number
If v_Returncode = 0 then
WScript.echo "FTP return code =" & v_ReturnCode
Else
WScript.echo "FTP return code =" & v_ReturnCode
WScript.echo "FTP command errored out"
Call emailer
v_msg = "Process Completed: " & time
WScript.Echo v_msg
Wscript.Quit 1
End If