Link to home
Start Free TrialLog in
Avatar of IT CAMPER
IT CAMPERFlag for United States of America

asked on

Script to disconnect mapped drives and connect mapped maps

I need a script that will prompt the user for their location, then execute based on the user input.  Either choice will disconnect X, Y, and Z mapped drives and then map X, Y and Z based on their choice.  They will have two location choices to select from.  Based on their choice, the script will map the three drives based on UNC paths I provide to the script.  Feel free to include any additional intelligence into the script based on experience.  In the past, I have used a batch file for this but it has not done too well with consistently performing.  Sometimes it would not delete or not remap.  Sometimes it will say the drives were already in use, so I am preferring VB script since it can likely better handle things.  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Mohammed Khawaja
Mohammed Khawaja
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IT CAMPER

ASKER

Ok, I like the gateway option.  Can you code more specifically how it chooses the correct site based on that IP?

Site 1 is 192.168.0.204

Site 2 is 192.168.0.252
What you need to do is identify all the gateways for your LAN and then you could change the script to ensure other sites are included (you specify the gateway).

The script is written where you specify the gateway is let's say x.x.x.x and you identify it as site 1 (i.e. 10.10.1.1 is gateway for San Francisco office, etc.).

You could also add another menu item where the user has the choice of selecting None which means he/she is not at any of the specified sites and for which you could set default mapping.  Let me know what you want and I could do it for you.