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

Remove network drive in .Net Application

Status
Not open for further replies.

EagleTempest

Technical User
Jun 15, 2004
125
CA
VB 2005 & .Net Framework 2.0 on XP SP2.
Maybe it's just my computer acting up being a VB6 application I wrote before is also giving me problems lately with remapping network drives.

I want to force P drive to disconnect. I've included Windows Script Host Object Model Version 1 reference. I'm using:
Code:
Imports IWshRuntimeLibrary

Dim WshNetwork As New WshNetwork

WshNetwork.RemoveNetworkDrive("P:", True)

It will not disconnect P drive. I can't figure if some background process is using P drive or why forcing it doesn't work. At the command line, net use P: /delete works fine but this code doesn't do anything. Any ideas?

 
I don't believe you can error check a shell command or can you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top