wigmeister
asked on
RDP xcopy failing when logged off
I have a dos batch file that runs on a local server that connects to outside servers, maps a drive with net use, and copies files using xcopy. The batch file is scheduled to run using Windows.
I connect to the local server (Windows 2003) using RDP on my local machine (Vista). The batch file runs perfectly as long as I stay logged on to RDP, but as soon as my session expires or I log off, the xcopy command stops working.
rasdial "Customer VPN" xxx xxxxxx
@echo VPN connection had a return code of %errorlevel% >> c:\log.txt
net use x: \\xx.x.x.x\custdata /user:domain\xxx xxxxxx
@echo Net Use had a return code of %errorlevel% >> c:\log.txt
xcopy f:\mydata\data\task.dbf x:\customer\Data /y
@echo Task dbf file copy had a return code of %errorlevel% >> c:\log.txt
When logged in all return codes are zero. When logged off all are zero except the last one, the xcopy has a return code of 4.
F:\ is a local drive mapped on my local server. I am wondering if RDP is not keeping that drive mapped when logged off, or the local server is not keeping it mapped when logged off, or if there is something else wrong?
Some additional info: My company had a server crash (not the one I'm using) a while back and everything worked perfectly before that. At that time the server I was using became the main production server and my processes were temporarily stopped for a couple of months. When I recently started these processes again is when my issue showed up. So the possibility exists that something was changed from an admin point of view on the server regarding RDP/drive mappings.
I need to be logged off and have the xcopy work correctly. My current workaround is to stay logged on all day long, but if I'm away from my desk for any extended period of time, my session times out and the copy fails.
Thanks for your help.
I connect to the local server (Windows 2003) using RDP on my local machine (Vista). The batch file runs perfectly as long as I stay logged on to RDP, but as soon as my session expires or I log off, the xcopy command stops working.
rasdial "Customer VPN" xxx xxxxxx
@echo VPN connection had a return code of %errorlevel% >> c:\log.txt
net use x: \\xx.x.x.x\custdata /user:domain\xxx xxxxxx
@echo Net Use had a return code of %errorlevel% >> c:\log.txt
xcopy f:\mydata\data\task.dbf x:\customer\Data /y
@echo Task dbf file copy had a return code of %errorlevel% >> c:\log.txt
When logged in all return codes are zero. When logged off all are zero except the last one, the xcopy has a return code of 4.
F:\ is a local drive mapped on my local server. I am wondering if RDP is not keeping that drive mapped when logged off, or the local server is not keeping it mapped when logged off, or if there is something else wrong?
Some additional info: My company had a server crash (not the one I'm using) a while back and everything worked perfectly before that. At that time the server I was using became the main production server and my processes were temporarily stopped for a couple of months. When I recently started these processes again is when my issue showed up. So the possibility exists that something was changed from an admin point of view on the server regarding RDP/drive mappings.
I need to be logged off and have the xcopy work correctly. My current workaround is to stay logged on all day long, but if I'm away from my desk for any extended period of time, my session times out and the copy fails.
Thanks for your help.
ASKER
The scheduled dos batch file runs under my id in Windows Scheduled Tasks. It doesn't run under admin. It runs every half-hour and the code in my question write-up is part of the code in that dos batch file. Not sure if that is what you were asking for or not.
Yes, that's what i was asking for but I don't know why it's not working...
The error is "4 - Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."
I understand that it's "path not found", it seems that it can't map the network drive and xcopy fails...
I'm sorry but I don't know how to fix it.
Good luck.
The error is "4 - Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."
I understand that it's "path not found", it seems that it can't map the network drive and xcopy fails...
I'm sorry but I don't know how to fix it.
Good luck.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Saved me again, Dragon! Thank you very much.
No problem... and thankyou. Your points have tipped me over into being a "Sage" in Windows Batch scripting... whatever one of those is!!
You have achieved Sage Certification in Windows Batch Scripting by earning 501,692 points! To celebrate your new rank, Experts Exchange would like to send you a free official Experts Exchange certified Shirt.
Sage
Windows Batch Scripting
501,692
You have achieved Sage Certification in Windows Batch Scripting by earning 501,692 points! To celebrate your new rank, Experts Exchange would like to send you a free official Experts Exchange certified Shirt.
Sage
Windows Batch Scripting
501,692
The scheduled task with what credentials run?
Hope this helps.