delete all manually configured mapped network drives

Folks have gone in and manually configured mapped network drives. I created a bunch of working batch files that map the network drives and printers upon logon. They run from the sysvol folder. Each user has a set of mapped drives for them. I am just missing the line in the .bat file that deletes all of those mappings they created manually.

I used the Net Use command to map the files and printers.

Can you help me delete all manually configured mapped network drives within this batch file?

Thank you in advance for you help.
LVL 39
Who is Participating?
A simple
net use * /delete /yes
at the beginning of the script will remove all mapped drive without intervention.
You might want to add
net use /persistent:no
after that, so that mapped drives aren't remembered by default.
Just put "net use <driveletter> /delete" for all available drive letters before you start mapping drives:

net use f: /delete
net use g: /delete
net use z: /delete

net use u: \\servername\path
net use x: \\servername\path
Blimey! I think that just about covers it....
ChiefITAuthor Commented:
Sweet, thanks guys.

If you all know me, I would rather shoot myself in the foot that create scripts or batch files. So, this is a big help to me.
ChiefITAuthor Commented:
So, I just woke up after a tanker of Java and about three hours sleep and find my answer. I have a new site with plenty of configuration issues that I am trying to weed out. So, bits of help like this really take some time and the edge off.

Thanks fellas. I am very passionate about hating scripts and batch files. It takes a special breed to program, I swear it. Scripting is an unfortunate evil for me in this profession. So, I really appreciate the help.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.