Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log off without clearing the mapped drive

Status
Not open for further replies.

cavie

MIS
Sep 10, 2003
28
SG
I have the following requirements:

On my scheduler,

o In the morning, I have a job to use 'net use' to mapped to a number of servers

o From morning to evening time, I have jobs to copy files from time to time from one mapped drive to another.

o In the evening, I want a job to delete all mapped drives.

The problem is that everytime the job is kicked off from the scheduler, the mapped drives is valid for that particular session only.

Qn : How can I retain the mapped drives when I logged off or quit a scheduled job, so that other jobs can use it?

Is this possible technically?



Thanks in advance
cavie
 

Having used batch files like this for unattended jobs, I agree with setting the net use and delete commands in each batch file. Simple to do, and keeps the problems down.

Since you are using scheduler to call each job, just put the commands into the batch file for each different job, i.e., establish the job drive, run the job, delete the drive and exit.

Oh yes, one other thing, use different drive letters in each batch job, it will help you trouble shoot when one of the batch files misbehaves and fails to complete, as it will leave the drive connected with that letter.

HTH,

David
 

Hi David,

Agreed with the following

"Since you are using scheduler to call each job, just put the commands into the batch file for each different job, i.e., establish the job drive, run the job, delete the drive and exit. "

The problem is that some jobs make take a while to complete and it will overlap each other in execution. When that happen, the latter job will detect that the drive is locked by the earlier job, then accessing to the shared drive will fail.

Therefore the safest way is to maintain the shared drive for all jobs to access. But so far, no luck. Anyone had any idea to do so?








 
cavie,
I am making the presumpption that the different jobs are using different data files, and that is the reason to use different drive letters for each batch file. The system will accept concurrent multiple maps to the same remote drive, and all will run concurrently and be very happy.

If, however, your problem is the file on the remote system being in a locked (held open,, in use) state, then you have other issues to address, not the first being that you would always run the risk of overwriting a newer version of a stored file with old data, but holding the drive open poses the same risk if you have multiple programs all using the same file.

HTH
David
 
Try using UNC paths in your copy commands instead of mapped drives. I just it and it worked, I didn't think the Copy command supported UNC...
 

Thanks to all who had responded.

I have checked and realised 'net use' is essentially a session based command. No way to inherit this session properties to other session.

The only way is to use UNC path directly, but that mean you will require authentication everytime u setup a session.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top