I am trying to use following command to map a drive in persistent mode, and I don't want it to ask login credentials everytime I reboot the machine:

net use P: \\server\folder Password123 /user:user123 /savecred /persistent:yes

But I am getting folowing error:

A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.

I followed this article:

Please help with this issue.

Dani AI

Generated

is on the right track: the error appears because you combined inline credentials with the /savecred switch. In practice, pairing a plaintext password on the command line with /savecred trips NET HELPMSG 3510 (conflicting switches). Remove the inline password and let Windows prompt once so it can store the credential. For example:

net use P: \\server\share /user:DOMAIN\user /savecred /persistent:yes

This saves the credential for that user and automatically reconnects the mapping at logon. See the official syntax and switch behavior, including /savecred and /persistent. (learn.microsoft.com)

If you prefer not to be prompted, pre-seed Credential Manager, then map the drive:

cmdkey /add:server /user:DOMAIN\user /pass:YourPassword
net use P: \\server\share /persistent:yes

The first command securely stores the credential for the target host; the second relies on that stored credential. (learn.microsoft.com)

Still getting prompted after reboots on Windows Server 2008 R2? Check the local or domain policy Network access: Do not allow storage of passwords and credentials for network authentication. If this policy is enabled, Windows will not keep saved credentials, and you will be asked to re-enter them at each logon. Ensure it is Disabled (or Not Configured) on the server, then try again. (learn.microsoft.com)

Quick cleanup tips before re-trying:

  • Remove any stale mapping: net use P: /delete
  • Remove any saved credential for that host: cmdkey /delete:server

Community notes: This exact conflict (inline password + /savecred) has tripped others; using /savecred without supplying credentials on the same line resolves it. (stackoverflow.com)

Recommended Answers

All 2 Replies

I beleive your problem is with the /savecred switch. I dont think you need it. Since you are using the /persistent switch, I dont see why you need the /savecred as well.

The /persistent:yes saves all connections as they are made, and restores them at next logon.

Also on your /user switch, the correct use is /user:domainName\username

Thanks JorgeM for your input. Earlier I used only the /persistent swith, but it is not working properly in Windows server 2008 R2. Everytime I restart it asks for credentials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.