I have been using some simple VBScript to identify a users mapped drives but have found all sample scripts I have tried omit any Mapped Drive that is Unavailable (as listed in CMD Net Use)
Because I need to remove such drives before remapping how can I identify any that are already unavailable?
Sample script lists drives nicely but only those with a Status of OK:
On Error Resume Next
Dim objNetwork, objDrives, objShell
Dim strSubst, strSubstVal, strSubstName, strEnumDrive
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Shell.Application")
Set objDrives = objNetwork.EnumNetworkDrives
For i = 0 to objDrives.Count - 1 Step 2
strSubst = objShell.NameSpace(objDrives.Item(i) & Chr(92)).Self.Name
strSubstVal = inStr(1,strSubst, Chr(40)) - 2
strSubstName = Mid(strSubst, 1, strSubstVal)
strEnumDrive = strEnumDrive & "Drive Letter: " & objDrives.Item(i) & vbCrlF & _
"Drive Name: " & strSubstName & vbCrlF & "Drive Path: " & _
objDrives.Item(i+1) & vbCrLf & vbCrLf
MsgBox strEnumDrive ,, "All mapped Drives"
Open in new window
Any suggestions on modifying this script or using another method?
First script shows just what I need, second script is faster but omits anything Unavailable
Now I have identified which mapped drives are Unavailable I can't find any way of scripting their removal
Normal delete using "objNetwork.RemoveNetworkD
Is there a way to remove an identified objItem.LocalName as found in your first script?