I have been working with mapping drives inside sql server.
I mapped something similar to this:
EXEC XP_CMDSHELL 'net use y: "\\my_server\Initialed Folders\MM" @@__password__@@ /User:mycompany\m_miorelli /persistent:NO'
and that was more than 3 months ago.
by now I have changed my password.
then when I go to the same sever, lets call it my_server, and I run this
EXEC XP_CMDSHELL 'net use'
I get this result:
you see there is a z: drive still hanging there, I don't know exactly how, maybe I mapped it... persisted
When I try any operation that involve the server where the backups live I get this error message:
restore filelistonly from disk=N'\\backup_server\ Initialed Folders\MM\backup_of_a_database.bak'
Msg 3201, Level 16, State 2, Line 20
Cannot open backup device '\\backup_server\ Initialed Folders\MM\backup_of_a_database.bak'. Operating system error 1326(The user name or password is incorrect.).
Msg 3013, Level 16, State 1, Line 20
RESTORE FILELIST is terminating abnormally.
I have tried doing this:
exec xp_cmdshell 'net use \\ip\xxx pass /user:xxx /persistent:no'
question(s):
how can I get rid of that mapped drive? or very specific objective: how can I get rid of this wrong password thing?
this is not happening in any other server.
Update
Following the advice from Craig in the comments, thanks Craig, I removed my mapped drive
EXEC XP_CMDSHELL 'NET USE Z: /d'
That made me happy and thankful, However, that did not solve the issue.








