18

I've been tearing my hair out trying to get Windows to remember the credentials to a network share, and almost all attempts were completely fruitless.

I have two Windows machines, one being a media center that is supposed to access content on the other, but every time it fails to remember the credentials and requires a manual login to the remote share to get things going.

I tried various thing. Adding the credentials to Credential Manager, trying to change the NTLP security level, changing the username/passwords of the two machines to match, and I'm sure I tried other things too, nothing worked.

4 Answers 4

12

This problem seems to stem from Windows attempting the initial connection to a networked drive using the its host's domain (the "Current Domain" in the picture) instead of the network server's domain (the "Desired Domain" in the picture).

For the following example let us assume the username of a user who is authorized to access the network drive is "SomeUsername". If I entered "SomeUsername" into the username field of the box below and then also entered the correct password Windows would connect to the network drive, but when I restated my computer Windows would not remember the username and password, even if I had checked the "Remember my credentials" box. The solution is to change the domain you enter your credentials. As noted in the picture you will need to type "\{DOMAIN}\{USERNAME}" in the username field without entering a password then click OK. For this example I would enter \FREENAS\SomeUsername into the username field, leave the password field blank, then click OK.

enter image description here

After you do that you will get a new pop up that looks like the one below. Enter the correct password, check the "Remember my credentials" box, then click OK. The next time you restart Windows your network drive should reconnect.

enter image description here

One side note, the part where you leave your password blank isn't really necessary, but leaving the password blank as suggested will allow you to clearly see what domain name Windows is going to store with the credentials you enter.

2
  • +1 Really cool - that worked for me!
    – Olaf
    Apr 11, 2014 at 10:12
  • This seems to be "the" answer. The "net use" incantation suggested by user8228 did not work - as it did not work for @Acorn. Sure it logs me in, but it doesn't "persist".
    – mike65535
    May 21, 2018 at 17:39
3

Use NET USE with /savecred and /persistent:yes to permanently save the credentials

net use \\Hostname /savecred /persistent:yes
4
  • I tried that and had no luck, hence the last resort of authenticating at startup. I assume your solution should work when Windows isn't being evil, so +1
    – Acorn
    Jul 12, 2011 at 13:22
  • what output/error message you got ?
    – user8228
    Jul 12, 2011 at 13:26
  • There's no error message, just after rebooting the credentials are not remembered and you need authenticate again.
    – Acorn
    Jul 12, 2011 at 15:00
  • This answer is not saying anything wrong. It does not solve the problem either.
    – krawyoti
    Oct 25, 2013 at 15:16
3

Click Start -> Search "Credential Manager" and run it. Click 'Add a Windows credential' and enter your information. Your information will now persist

2
  • lol - I've been a Windows enthusiast for 25 years, and I'd never known of this facility! And this fixed my issue. Thank you!!!
    – Mordachai
    Mar 25, 2019 at 13:25
  • FWIW - I used that utility to first delete all stored credentials for the problematical share - rebooted - had to delete existing pinned shortcuts - rebooted again - then connected to the share and I got just the one correct dialog and used "remember" and all is well. I can see and verify it in the Credential Manager.
    – Mordachai
    Mar 25, 2019 at 13:26
0

I eventually managed to come up with something that worked!

You need to automatically authenticate to the share each time the machine is started, which can be done with a batch script.

This is what you need in your script:

net use \\theremotemachine ThePassword /user:Username

Based on info from here and here.

Now, I didn't have any luck getting this working using task scheduler for some reason, so I ended up using a program called hstart. It allows you to launch hidden batch scripts.

I created a shorcut, put it in the Startup folder, and changed the Target to:

C:\hstart.exe /NOCONSOLE “C:\script.bat”

And there you go, there should now be no problems accessing the shared folders on the remote machine.

I think there may be a problem if the other machine isn't on when the script runs, but I'm not sure how you could get around that..

Hope someone else finds this useful.

4
  • You can also add /persistent:yes at the end of your net use command.
    – jftuga
    Jul 12, 2011 at 12:51
  • I tried that and it would still forget the credentials :(
    – Acorn
    Jul 12, 2011 at 13:18
  • There will be an event under the Event Viewer I would check there.
    – surfasb
    Jul 12, 2011 at 22:05
  • 4
    -1 @Acorn, this is not a good solution. While it probably is solving your connection problem it is a really bad idea to store password in clear text. See my answer to make sure you have entered the correct domain for your credentials. Jul 6, 2013 at 4:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .