6

kind of a weird question but how do I make a drive go from a OK state to disconnected state using net use? I do not want to delete it.

I am testing a script but the annoying thing is that to test the item I want I require a disconnected drive. I can't find anything anywhere as to how to do this.

If I do this:

net use X: /delete => then this deletes the drive.

I want the status of a drive to be "Disconnected"

Any ideas?

EDIT: I have taken the network offline and that disconnected a drive (i.e. the drive is now in a disconnected state)....not an ideal solution so if anyone has an idea where the network can remain online and I can make a drive "disconnected" that would be great!

1
  • Do you have access to the server/computer that's sharing the folder? You could use net session to terminate your session on the server/computer. Jan 18, 2016 at 14:02

3 Answers 3

0

One possible workaround that comes to mind is to use pause between connecting and disconnecting the drive.

net use X: /delete
pause
net use x: \\pathToshare

The downside is that you will need to press a button on the screen that is running the script when you want the script to continue.

0

You can restart the "Workstation" service, on the client computer.

net stop LanmanWorkstation
net start LanmanWorkstation
-2

Add server name with bogus IP address to hosts file. That should do the trick.

1
  • 2
    More detail might avoid more downvotes
    – Dave M
    Jun 13, 2016 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .