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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disconnecting network drives....using IWshRunTimeLibrary.IWshNetwork

Status
Not open for further replies.

GSMike

Programmer
Feb 7, 2001
143
0
0
US
This question is related to another post I just made, "Using batch file to map, unmap drives..." in that, I was have problems mapping and unmapping drives using IWshRunTimeLibrary.IWshNetwork, so I opted to use batch files. Then I hit a roadblock there, too.
So we're back to IWshRunTimeLibrary.IWshNetwork.
The problem here is that when i use:

Code:
sub mytestsub()
dim fso as new filesystemobject
fso.removenetworkdrive "q:"
fso.mapnetworkdrive "q:","\\myserver\mynewshare"
end sub
,

everything works great until I try to apply this method to a remote server. So, if I disconnect a share from a server here in our office, it works great. But, if I try to do the same for a server in Denver, a problem occurs.

The problem is indicated in NT Explorer by a small red "x" icon under the drive icon for the drive I'm trying to disconnect. Instead of the disconnected drive disappearing, the small "x" appears beneath it. If I go to a command prompt and try to access the drive, it says the drive is not available. However, as the code above indicates, if I try to remap the drive, an error occurs stating that the drive is already mapped elsewhere. If I single-click on the drive icon in NT Explorer, the red "x" disappears, and the drive apparently automatically re-maps, because all the files appear in the right pane.

Does anyone have any insight into why I would be able to fully disconnect a local share/server, but not a remote? If so, do you have any suggestions on how I could accomplish the goal of disconnecting and re-mapping a remote share using IWshRunTimeLibrary.IWshNetwork??

Thanking you in advance,

Mike K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top