Error 1312 from net use when mapping samba share
Asked Answered
C

3

14

I have written a service that monitors if my app is running and starts it if not. In result the app is run as a "system" user - which is the way I want it to be. I have several of those installations working properly. The app should mount a network share that is in this case available on a linux samba server. The problem is that when running the command:

net use X: \\IP\share_name /user:login password

an error is displayed:

System error 1312 has occured.

A specified logon session does not exist. It may already have been terminated.

I have run some checks and it turns out that the X: drive in local system is available, the server is online, the share is available, the credentials are OK, there are no other net use sessions running in this system. Also I have found out a strange behavior: running identical command as a standard user gives proper results and the drive is mounted properly. Do you have any suggestions what might be the problem and how to solve it?

Additionally I am not a domain member, and the system that shows the error is Windows 7 Pro. I have other machines in the same network that do work properly without the error.

Cha answered 5/9, 2016 at 8:17 Comment(0)
N
28

I have had the same issue some time ago. It helped when I introduced a domain name (even if you are not a domain member) before the login. I your case try this command: net use X: \\IP\share_name /user:whatEver\login password

Nonchalance answered 5/9, 2016 at 10:54 Comment(2)
That was just to easy. Thanks!Cha
Indeed, it still works ;DPalaeontology
M
0

Test this command:

EXEC XP_CMDSHELL 'net use Z: 192.168.3.55backupShare password@123 /User:domainuser'

Mohn answered 16/6, 2020 at 3:49 Comment(1)
You need to include inline code span so the code is readable & verifiable.Teresa
E
0

I've just run into the same problem on upgrading to Windows 10 PE 2004 (19041). The older Windows 10 PE 1803 (17134) did not require the dot before the username.

Here's the solution:

  1. Put the password before the user (this is the argument order given by net use /?).
  2. Add the server's name, IP or a dot and then a backslash (.\) before the username .

Use:

net use X: \\IP\share_name password /user:.\login

or

net use X: \\IP\share_name password /user:IP\login

If you have arguments with spaces, add parenthesis around them:

net use X: "\\IP\share name" "pass word" /user:".\test user"
Endurable answered 21/9, 2021 at 17:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.