Cannot disconnect network drives in Windows 7

7

1

I'm running into a curious issue. As part of a deployment routine, I'm mounting the c$ share of a remote server and copying files to that share, then disconnecting it with net use <drive> /delete. However, I'm encountering strange behavior:

C:\Users\user>net use T: /delete
System error 2 has occurred.

The system cannot find the file specified.

Okay, well I'll just use Windows itself to disconnect the file. Computer shows:

enter image description here

Well that's odd...let's just right-click -> Disconn...oh...

enter image description here

Since this isn't a persistent mount, it'll be gone on a reboot. However, I'd like to know why this happens. On a related note, all my network drives have the red "X" but I can get into all of them just fine. I don't hear problems from other users on the network, so it's puzzling.

Oh, to add to the puzzle:

C:\Users\user>net use
System error 2 has occurred.

The system cannot find the file specified.

Any idea what's going on? This is Windows 7 Pro x64, all updates applied.

Nathan C

Posted 2014-05-01T16:51:46.330

Reputation: 2 522

Still having this problem...and it also happens with drives I just mapped manually – Nathan C – 2014-06-20T15:46:39.597

Does it happen just on this machine, for all drives? Or does it happen just on certain drives, from every machine? – Jason C – 2014-06-20T16:14:34.117

Just this machine, all drives. – Nathan C – 2014-06-20T16:15:24.677

See Google results for "net use system error 2 has occurred". In particular, one user found that by uninstalling then reinstalling recent Windows updates, the problem was resolved. Another user had to manually install net1.exe. You could try the old sfc /scannow as well.

– Jason C – 2014-06-20T16:17:52.393

(1) Is there any difference when using the syntax of "net use \server\C$ /delete" or "net use * /d"? (2) See with Process Explorer if anything is using the share. (3) See if the registry hack in this article helps.

– harrymc – 2014-06-21T08:17:00.070

@NathanC Have you tried a different drive letter? There might be some confilct. – EliadTech – 2014-06-22T22:07:14.300

@harrymc Same error message. Process Explorer says nothing open, and the registry hack doesn't work...the entry isn't there. – Nathan C – 2014-06-22T23:44:13.707

Try also the advice in this article.

– harrymc – 2014-06-23T09:37:19.070

What do you get when you just type net in cmd? You might have some messed up permissions where you can't access what's in the System32 folder... – Kinnectus – 2014-06-23T15:26:57.180

@BigChris It gives me the syntax of the command. If I type net use, I get the "cannot find the file specified" error. – Nathan C – 2014-06-23T15:29:50.907

Are the drives mapped w/ the same account running net use /delete ?? – MDMoore313 – 2014-05-01T16:52:38.707

@BigHomie Yes, they are. – Nathan C – 2014-05-01T16:52:59.913

Can you delete them after you go into the drive (and thus, after the red X goes away) and exit back out? – MDMoore313 – 2014-05-01T16:53:50.150

@BigHomie Nope. The red X still remains as well. – Nathan C – 2014-05-01T16:54:29.333

Have you patched heartbleed? – MDMoore313 – 2014-05-01T16:55:32.523

2@BigHomie Well...yes, don't see how that relates though. – Nathan C – 2014-05-01T16:55:58.450

Is this being run in an elevated cmd prompt? – MDMoore313 – 2014-05-01T16:57:50.963

@BigHomie No. Elevated has the same errors as above (but is expected since the mounts wouldn't be visible) and net use alone also shows the same error. – Nathan C – 2014-05-01T16:59:09.970

1..As part of a deployment routine, I'm mounting the c$ share of a remote server and copying files to that share.. Can you provide more detail as to how/when these drives are mapped, and also has this always been a problem, or is this a new problem, or new deployment routine (new routine meaning there's really no baseline of this ever working in the past) – MDMoore313 – 2014-05-01T17:21:59.450

@BigHomie Brand new routine...so new, I just encountered this problem while writing it. It's really a simple batch file with net use and robocopy commands. – Nathan C – 2014-05-01T17:24:12.970

that runs at login? Located in a group policy, or Windows startup folder? Can you use powershell instead? – MDMoore313 – 2014-05-01T17:25:11.500

@BigHomie I run it manually after I do a build in visual studio. There's plenty of other methods I could use, but I chose this way. Remove-PSDrive T returns no errors, but the drive still persists. – Nathan C – 2014-05-01T17:27:17.427

Answers

8

Some Googling reveals someone else that had this issue. The problem was down to an issue with a registry key. Their issue was on Windows Server 2008, but the same principle for Windows 7.

Open Regedit, and navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order

Find the string called "ProviderOrder", the value should be a string with multiple values separated by commas (for example mine is: "RDPNP,LanmanWorkstation,webclient,BCMLogon"), ensure "LanmanWorkstation" is one of the values.

Credit / source: http://panerarichang.blogspot.co.uk/2011/07/win2k8error-code-0x80070002-system.html

Update: I was able to recreate the issue you faced by removing "LanmanWorkstation".

Joey

Posted 2014-05-01T16:51:46.330

Reputation: 376

Mine is nfs41_driver,RDPNP,LanmanWorkstation,webclientc, so that doesn't appear to be the issue. It does give me a few other ideas as I have the NFS client installed as well as ExpanDrive to access my nagios box... – Nathan C – 2014-06-23T15:31:25.953

2Just for testing, what happens if you change it to the same as mine? "RDPNP,LanmanWorkstation,webclient,BCMLogon". Since this is an order of priority, something else might be trying to handle it. – Joey – 2014-06-23T15:33:11.353

Try uninstalling those softwares and see what effect that has... – Kinnectus – 2014-06-23T15:33:12.640

3Thank you. the nfs41_driver was the problem. After changing the order it works properly. – Nathan C – 2014-06-23T15:50:24.673

4

I had the same problem but it was caused by a defective NFS4.1 driver installed by a Windows NFS client I had had used recently.

Inspired by other answers to this issue, I checked this Windows Registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order

I had a string value named ProviderOrder containing this data: nfs41_driver,XwpNTrdr,RDPNP,LanmanWorkstation,webclient.

Unlike other users reported, LanmanWorkstation did appear; the problem was caused by nfs41_driver. Just remove it off the list and it will work again.

José Ángel Morente

Posted 2014-05-01T16:51:46.330

Reputation: 41

1Please clarify and add a little more context to this answer to convey what you are suggesting exactly. – Pimp Juice IT – 2017-09-07T00:05:41.117

I had this exact same issue. I knew it was down to trying out mounting NFS4.1 on windows 7 pro. Could only find this SuperUser post once i discovered 'net use' returned an error. NFS driver was the issue. – SimonAlfie – 2018-10-08T13:53:02.100

0

In my case it was hiding in the registry: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2]

When I deleted the corresponding key the drive disappeared for good.

source: unable to delete a network drive in windows 7

Maciej Jankowski

Posted 2014-05-01T16:51:46.330

Reputation: 161