In our setup, the robot logs on to a virtual Win11 machine with its main account, then has separate process-specific credentials to carry out automations. To map network drives that can only be accessed by the process-specific accounts, we use Invoke PowerShell twice. Once to delete all existing connections, and once to map the new connection. It works most of the time. But it fails way too often to be ignored and we can’t seem to figure out the issue.
The first Invoke PowerShell command is: String.Format("net use * /delete /yes")
The second Invoke PowerShell command is: String.Format("net use Z: {0} /user:$Username $Password", Config("SharedDriveMapPath"))
We often get this error message: Robot was NOT able to map shared drive - 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.
Wondering if anyone else has had a similar issue and found a solution? Could it be the first command is not given enough time to execute? Our VMs are notoriously slow, so that could be a factor.
Yes, try deleting the connection to that specific server before mapping the drive again. Error 1219 usually means Windows is still connected to the same shared server using another account. So even if net use * /delete /yes runs, some old connection may still be active.
A simple fix is to delete the existing Z: drive, delete any connection to the shared server, wait a few seconds, and then map the drive again using the process account. Also use /persistent:no so Windows does not save or reuse old mappings.
For example:
net use Z: /delete /yes
net use \server\IPC$ /delete /yes
timeout /t 5
net use Z: “\server\share” “password” /user:“domain\username” /persistent:no
Also check Credential Manager on the VM and remove any saved credentials for that server. The slow VM may be part of the issue, but the main cause is usually an old connection to the same server still being active under a different user account.
Cause: an existing connection to the same server is still active under another account. net use * /delete may not immediately clear all server sessions, especially on slow or unattended machines.
Fix: disconnect the specific server/share connection before remapping, and remap the drive in each run. Where possible, use the UNC path directly instead of a mapped drive, as mapped drives can be unreliable in unattended sessions.
If helpful, mark as solution. Happy automation with UiPath