0

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:

enter image description here

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'

enter image description here

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'

enter image description here

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'

enter image description here

That made me happy and thankful, However, that did not solve the issue.

enter image description here

Marcello Miorelli
  • 17,274
  • 53
  • 180
  • 320

1 Answers1

0

there were entried in the registry related to that mapped drive. I had to do quite a few things to get this sorted, including rebooting the box a few times.

make sure you access the registry as administrator.

here a sequence of pictures:

enter image description here

enter image description here

enter image description here

enter image description here

Now what really did the trick was from the same place I had create the share I run:

EXEC XP_CMDSHELL 'NET USE * /DELETE /YES'

This got rid of the share.

Marcello Miorelli
  • 17,274
  • 53
  • 180
  • 320