On Error Resume Next Set objNetwork = CreateObject("Wscript.Network") Set colDrives = objNetwork.EnumNetworkDrives For i = 0 to colDrives.Count-1 Step 2 objNetwork.RemoveNetworkDrive colDrives.Item(i) Next
Little syntax help:
objNetwork.RemoveNetworkDrive(strName, [bForce], [bUpdateProfile])
Key:
objNetwork : A WScript.Network object
strName : The mapped drive you want to remove.
bForce : Force the removal of the mapped drive (TRUE/FALSE).
bUpdateProfile : Remove the mapping from the user’s profile (TRUE/FALSE).