Discussion Locked

Login Scripts

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a quick question. Is there a way in DOS that when I create a mapped network drive and save it to a bat file that I can instruct it to be a temp mapped drive? The problem I am having is when a user logs in to our domain it runs the bat file and comes up with errors saying the drive already exsists, as when the script it ran for the first time and the drives don't exsist it the script works great.

Here is how our script looks. Is there anything I can add to make it only a temp one so when the user loggs off it will unmap it and not reconnect at login?

net use I: \\Server02\Apps
net use J: \\Server02\Acct

3 replies

by joseph moore

In the BAT file, put this line in first, before you start mapping drives:

NET USE * /D /Y

That will DISCONNECT all mapped drives that exist. THEN you run the other Net Use lines to map drive I and J like you posted.

by ctmoore1998

Just remove the mappings by adding the following at the beginning of your script
NET USE I: /D /Y
NET USE J: /D /Y

OR
NET USE * /D /Y

These will end any share then your batch can recreate them with the net use commands that you have.

by arne.tredal

To make the mapping "temp mapped" use;
net use I:\\Server02\Apps /Persistent:NO
net use I:\\Server02\Acct /Persistent:NO

This discussion is closed to new replies.