Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removenetworkdrive doesnt work

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
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


 
bookouri,

Comment out the On Error statement and determine what error you are getting. Please show the code for unmapping the drive if you can.

fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top