Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Net.exe use 'Error: A command was used with conflicting switches.' while using /savecred

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: http://pcsupport.about.com/od/commandlinereference/p/net-use-command.htm

Please help with this issue.

like image 818
sabertooth1990 Avatar asked Aug 01 '13 14:08

sabertooth1990


2 Answers

When we use /savecred switch we should not give the credentials in the same line. The correct command should be:

net use P: \\server\folder /savecred /persistent:yes 

It will ask for username and password.

like image 119
sabertooth1990 Avatar answered Sep 20 '22 16:09

sabertooth1990


You can add your credentials to Windows Vault and then map you drive, this way you can avoid the limitation sabertooth1990 mentioned:

CMDKEY /add:%server% /user:%username% /pass:%password% NET USE \\%server%\%folder% %localdrive% /SAVECRED /PERSISTENT:YES 
like image 36
bugrasan Avatar answered Sep 17 '22 16:09

bugrasan