title: Mapping and Remapping Network Drives with Different Users on Win7
body: <p>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.</p>
  
  <p>Currently, I am connecting using the command:</p>
  
  <pre><code>net use z: \\server_ip\share password /user:doman\username
  </code></pre>
  
  <p>and I am disconnecting using the command:</p>
  
  <pre><code>net use z: /delete /y
  </code></pre>
  
  <p>Furthermore, I verify the resource is no longer connected by simply examining that it is not listed on the <code>net use</code> command. </p>
  
  <p>However, if I disconnect and then try to reconnect as a different user, I am hit with a </p>
  
  <pre><code>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.
  </code></pre>
  
  <p>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. </p>
  
  <p>I think that perhaps the issue is cached credentials, but when I examine the credential manager in Control Panel, there is nothing listed.</p>
  
  <p>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?</p>
  
  <p>Thank you for any suggestions/help!</p>
  
  <p>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. </p>