Dim oNetwork, oDrive, iDrive, bKeepInProfile
Dim sDriveLetter, sOldPath, sNewPath
sDriveLetter = ""
sOldPath = "\\OLDPATH"
sNewPath = "\\NEWPATH
bKeepInProfile = True
Set oNetwork = CreateObject("WScript.Network")
Set oDrive = oNetwork.EnumNetworkDrives
If oDrive.Count > 0 Then
For iDrive = 1 to oDrive.Count - 1
If UCase(oDrive.Item(iDrive)) = UCase(sOldPath) Then
sDriveLetter = oDrive.Item(iDrive-1)
oNetwork.RemoveNetworkDrive oDrive.Item(iDrive-1), True, True
End If
Next
Else
End If
If sDriveLetter <> "" Then
oNetwork.MapNetworkDrive sDriveLetter, sNewPath, bKeepInProfile
Else
End If
Set oDrive = Nothing
Set oNetwork = Nothing
|