I have a mapdrive function that is supposed to check for and unmap a network drive if it is mapped, then map the drive. the removenetworkdrive doesnt work right. Any drive it removes is removed if you look in mycomputer, but it will not ever remap it. If I do a new use the previous drive mapping shows up in the map drives list where everything else is OK, this drive show up as Unavailable. Ive found dozens of script examples of this and no mention of anything that would make it not work. Any ideas would be appreciated..
Function MapDrive(Drive, FileServer, Share)
on error resume next
If oFSO.DriveExists(Drive) = True Then
onet.RemoveNetworkDrive Drive
end if
If oFSO.DriveExists(FileServer & Share) = True Then
oNet.MapNetworkDrive Drive, FileServer & Share
wscript.echo "Mapping drive " & Drive & " to " & FileServer & Share
Else
wscript.echo "Cannot Map " & Drive & " to " & FileServer & Share
End If
End Function
Function MapDrive(Drive, FileServer, Share)
on error resume next
If oFSO.DriveExists(Drive) = True Then
onet.RemoveNetworkDrive Drive
end if
If oFSO.DriveExists(FileServer & Share) = True Then
oNet.MapNetworkDrive Drive, FileServer & Share
wscript.echo "Mapping drive " & Drive & " to " & FileServer & Share
Else
wscript.echo "Cannot Map " & Drive & " to " & FileServer & Share
End If
End Function