delete all manually configured mapped network drives

Posted on 2009-04-23
Last Modified: 2012-05-06
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.
Question by:ChiefIT
    LVL 28

    Assisted Solution

    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
    LVL 82

    Accepted Solution

    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.
    LVL 16

    Assisted Solution

    Blimey! I think that just about covers it....
    LVL 38

    Author Closing Comment

    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.
    LVL 38

    Author Comment

    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.



    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
    You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
    Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now