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.
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