Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phantom Mapped Network Drive Letter From Windows To Linux

Tags:

net-use

I've been using robocopy and mapped network drives to copy backups across untrusted windows domains to a central location, then push them to a Ubuntu storage device and I'm running into a lot of anomolies. One that I am seeing right now is mapped network drives that do not seem to exist under any user context. These are all being executed as me personally, or 'run as admin', both have the same result.

Do note this does work in Powershell but not from CMD.

delete all mapped drives:

Z:\Scripts>net use * /delete
There are no entries in the list.

Attempt to delete W: drive explicitly

Z:\Scripts>net use w: /delete /y
The network connection could not be found.

More help is available by typing NET HELPMSG 2250.

Attempt to change directory to mapped drive, note logon failure

Z:\Scripts>w:
Logon failure: unknown user name or bad password.

Attempt to delete again

Z:\Scripts>net use W: /delete /y
The network connection could not be found.

More help is available by typing NET HELPMSG 2250.

No connections show up

Z:\Scripts>net use
New connections will not be remembered.

There are no entries in the list.

W: Drive Does Not Exist

Z:\Scripts>net use W: /delete /Y
The network connection could not be found.

More help is available by typing NET HELPMSG 2250.

Attempt to map a drive to it

Z:\Scripts>NET use W: \\servername\sharename PASSWORD /user:domain\username
System error 85 has occurred.

The local device name is already in use.
like image 865
Ali Razeghi Avatar asked Nov 13 '12 22:11

Ali Razeghi


2 Answers

I found an answer here that helped me in the same situation. Basically if the network drive was created automatically by the system then it was done by user nt authority\system and it can't be deleted even by administrator. To delete it as nt authority\system one can use PsExec for example:

psexec -s -i cmd
net use W: /delete
like image 180
Michał Cłapiński Avatar answered Oct 01 '22 10:10

Michał Cłapiński


Try rebooting the system so that you have no phantom drive and then map it again with

net use W: \\servername\sharename pass /domain\username /persistent:yes 

so that it remembers your credentials and then see if the problem occurs again. I had a similar problem once where a phantom drive appeared after 1-2 maps/disconnects and this worked for me then.

If that doesn't work try using just

net use /persistent:no

so that it remembers no connection at all and check again.

like image 43
cyph3r Avatar answered Oct 01 '22 09:10

cyph3r