Delete mappings

thenrich
thenrich used Ask the Experts™
on
With vb script how can I delete all current drive mappings?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013

Commented:
Does it have to be vbscript?   You can do this with a batch file
 
Echo Off
net use * /delete
Thanks
Mike

Commented:
I think this would be helpful:

http://www.computerperformance.co.uk/ezine/ezine32.htm

Best,
T
Network Manager
Commented:
Believe this should work for you.

Set wshNetwork = CreateObject("WScript.Network")

Set colDrives = objNetwork.EnumNetworkDrives

For i = 0 to colDrives.Count-1 Step 2
    wshNetwork.RemoveNetworkDrive colDrives.Item(i)
Next
remmett70Network Manager

Commented:
Typo:    Change objNetwork to wshNetwork when enumerating the network drives

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial