VBS or BATCH script to search a network drive for inputted folder and delete it RRS feed

  • Question

  • Hello, good day!

    I'm hosting several fileservers with the name myserv1, myserv2, myserv3 etc. On these servers I store the roaming profiles of the network users (i.e. \\myserv1\users$\testuser). Right now I'm having a couple of users that I want to delete, but since it are quite some users I would like to make a script for it. I think I first have to mount a network drive with NET USE, after the mounting I need to search for the profile name (in my example testuser) on the different servers (since I don't know on which of the servers it is) and then I want the folder deleted. Because the profile I want to delete can be different each time it would be great if I can input it.

    Is there a way to put this into a BATCH or VBA script?

    So it needs to search on different network locations (of my servers, myserv1 etc) for a folder that i can input myself and then delete it.

    Thanks in advance and have a nice day!

    Kind regards Andries

    • Moved by Bill_Stewart Thursday, June 19, 2014 8:57 PM Unanswerable drive-by question
    Monday, December 30, 2013 9:42 AM


  • You can get the folder location  from Active Directory.

    Look in Gallery for scripts like you need.  Post back with your script and any questions.

    We will not write the script for you.


    Monday, December 30, 2013 2:18 PM