Question : Cannot access files from Mapped Drive when user not logged in windows 2003 system

I have batch script to display all the files in the mapped drive. The job is to delete the old files but to test it, I have created a script to list the files in the mapped drive. THis job is scheduled in the windows 2003 system. This job works fine when the user is logged into the system. But it does not work when the user is not logged in.

The batch script is:

::ListDBFiles.bat -- this shell script will list the database daily backup files from L: drive.
::                        
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
echo execution of ListDBFiles.bat started  %date%-%time% >> E:\DBBackups\LOGS\ListDBFiles.log
net use L: \\ServerName\DBBackups persistance=no
L:
cd \
for %%F in (*.*) do (
    echo ***** %%~nxF Exist in L:\  >> E:\DBBackups\LOGS\ListDBFiles.log *****
)
echo execution of ListDBFiles.bat ended %date%-%time% >> E:\DBBackups\LOGS\ListDBFiles.log
E:
net use L: /delete
exit

The log file output is:
Successful Execution - when logged in the system, batch job run by windows scheduler.

execution of ListDBFiles.bat started  Fri 09/07/2007-11:34:42.76
***** _backup_200708300018.bak Exist in L:\   *****
***** _backup_200708310018.bak Exist in L:\   *****
***** _backup_200709010018.bak Exist in L:\   *****
***** _backup_200709020018.bak Exist in L:\   *****
***** _backup_200709030018.bak Exist in L:\   *****
***** _backup_200709040018.bak Exist in L:\   *****
execution of ListDBFiles.bat ended Fri 09/07/2007-11:34:43.01

Unsuccessful Execution - when logged in the system, batch job run by windows scheduler.

execution of ListDBFiles.bat started  Fri 09/07/2007-11:40:00.18
execution of ListDBFiles.bat ended Fri 09/07/2007-11:40:00.23
execution of ListDBFiles.bat started  Fri 09/07/2007-11:45:00.15
execution of ListDBFiles.bat ended Fri 09/07/2007-11:45:00.17

I tried with both persitance=no and persistance=yes. But it is not working.

At present, I am executing this job manually. Please let me know where I am going wrong.

Thanks
Sri

Answer : Cannot access files from Mapped Drive when user not logged in windows 2003 system

HyperData,

net use l: \\servername\dbbackups password /user:domain\username /persistance=no

sometime, if you dont put the domain name it will not work either..

hope that help
Random Solutions  
 
programming4us programming4us