Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping and Remapping Network Drives with Different Users on Win7

I am currently trying to develop an automated client-side test of a server that contains a network share. However, I need to verify its security by connecting with more than one user, although I only need to connect one user at a time.

Currently, I am connecting using the command:

net use z: \\server_ip\share password /user:doman\username

and I am disconnecting using the command:

net use z: /delete /y

Furthermore, I verify the resource is no longer connected by simply examining that it is not listed on the net use command.

However, if I disconnect and then try to reconnect as a different user, I am hit with a

System Error 1219 has occurred.

Multiple connections to a server or shared resource by the same user, using more
 than one user name, are not allowed. Disconnect all previous connections to the
 server or shared resource and try again.

I did some research and solutions like mapping two different drives, one using the ip and another using the server name are not acceptable since the test client will not necessarily know the server name. Restarting the computer is also not acceptable given that would interrupt the automated tests. Finally, I cannot modify any server settings using the test client, so no Samba aliases.

I think that perhaps the issue is cached credentials, but when I examine the credential manager in Control Panel, there is nothing listed.

Is there any way to make Windows completely disconnect from the server share and/or make it forget the cached credentials? Or am I doing something wrong?

Thank you for any suggestions/help!

EDIT: I should clarify, any solutions have to be done programatically since this is an automated test that should be able to resolve this issue should it arise. I am writing in Python, but I am willing to utilize a solution in any language that can run on Windows.

like image 451
user3846506 Avatar asked Jul 16 '14 19:07

user3846506


People also ask

How do I Map a network drive to multiple users?

Under User Configuration, go to Preferences, then go to Windows Settings. You will see an option for Drive Maps, right-click on it and then select New > Mapped Drive. Now create the drive mapping. For the Action, you'll want to choose "Create"


1 Answers

The issue has been resolved. Although I do not know exactly what did it, the following resource provided a number if possible fixes, many of which I tried and found unsuccessful, but perhaps some combination of them ended up working. I hope if other users come across this issue, this thread will be useful to them.

http://social.technet.microsoft.com/Forums/windows/en-US/ced8eab6-87e2-4d20-9d18-7aaf5e9713a3/windows-7-clear-cached-credentials?forum=w7itpronetworking

like image 53
user3846506 Avatar answered Oct 03 '22 06:10

user3846506