Mapping a network drive and having trouble saving password
Asked Answered
T

2

17

I'm running a batch:

"net use j: \\192.168.1.241\sausb /user:srvfeskar\administrator Ratata12 /persistent:yes /p:yes"

After restarting the windows 8 computer. I need to insert the password again.

Trainor answered 27/3, 2014 at 7:32 Comment(2)
Have you tried the /savecred switch to tell net use to save the credentials?Biography
Yes. when I add that I get a error. "A command was used with conflicting switches. More help is available by typing NET HELPMSG 3510"Seifert
B
30

If i understand it, you are not running the same command each time after restart. You want to run the command once and then in sucessive logins have the drive mapped without having to validate.

There are two options

  • In net use j: command include the /persistent:yes and /savecred switches, but do not include user or password data. It will be asked and then saved for later use.

  • Use the cmdkey command to store the required credentials in the machine.

    cmdkey /add:191.168.1.241 /user:srvfeskar\administrator /pass:Ratata12

    Then when net use j: \\192.168.1.241\sausb /persistent:yes is used, the credentials stored will be used for the mapping.

Biography answered 27/3, 2014 at 9:15 Comment(4)
I did try this, still it asks for username and password ? any suggestions ?Hoeve
This works for me: STEP 1: cmdkey /add:191.168.1.241 /user:srvfeskar\administrator /pass:Ratata12 STEP 2: net use j: \\192.168.1.241\sausb /persistent:yes /savecredAirlike
Very very weird that I can't simply specify one piece of information (username) from the command line and get prompted for the missing piece of information (password). Also the error message is anything but helpful.Importunate
I'm changing file servers soon, and cmdkey really saves the day here: I can now script how to forget the old credentials and store new ones, and my new persistent share reconnects automatically after a reboot.Abscise
G
6

/persistent and /savecred are mutually exclusive, and savecred cannot be used with a drive letter, you have to type two commands as follows:

net use j: \\192.168.1.241\sausb /user:srvfeskar\administrator Ratata12 /persistent:yes 
net use \\192.168.1.241\sausb /SAVECRED
Gemology answered 8/11, 2018 at 13:44 Comment(2)
This did not save my credentials. After you log out and log back in or restart the system, it cannot reconnect to the network drive. Also, the credentials do not show up in cmdkey \list. Tested on Windows 10.Oblast
net use \\192.168.1.241\sausb /SAVECRED is not enough to use scheduled task. cmdkey (or manual adding to credential manager) seems the needed procedure.Painting

© 2022 - 2024 — McMap. All rights reserved.