Link to home
Start Free TrialLog in
Avatar of bbimis
bbimis

asked on

how do you add to the windows credential manager using the command prompt

is there a way to add to the windows credential manager via the command prompt
I'm not referring to cmdkey but the actual windows credential manager apparently they are not the same thing.
When I use cmdkey /generic:TERMSRV/server /user:username /pass:password
it works fine it I run mstsc /v:server  
but if I run it from the desktop by clicking on a shortcut it prompts me for the password; however, if I put the credentials in windows credential manager I do not get the prompt

so, is there a a command to add a username and password to windows credential manager ?
I don't want any user interaction I want to run it through a bat script or psexec or something.
Thanks!
Avatar of joinaunion
joinaunion
Flag of Canada image

Did you try this command to edit your credentials?
rundll32.exe keymgr.dll, KRShowKeyMgr

It should try to log you on automatically afterwards.
Avatar of bbimis
bbimis

ASKER

that shows a user interface and you add the credentials there. I want to do it all from the command line because I have 100+ computers to touch thanks!
> When I use cmdkey /generic:TERMSRV/server /user:username /pass:password
it works fine it I run mstsc /v:server

> but if I run it from the desktop by clicking on a shortcut it prompts me for the password

Are you saying the shortcut points to the one that works fine, i.e. mstsc /v:server?
Avatar of bbimis

ASKER

correct but i'm wondering how do i make the shortcut via the command line because it will be something like this for 100+ pcs
mstsc /v:server1
mstsc /v:server2
ect
for each different location

otherwise i could just push out a shortcut that was premade with mstsc /v:server

but i also need to add the credentials to the windows credential manager so the shortcut will work.
the command mstsc /v:server will work without a prompt when i run it from the command line but prompts for a password when i run it from the desktop. I hope i'm making sense.
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> how do i make the shortcut via the command line because it will be something like this for 100+ pcs

If you know the names of the servers, put them in a text file. Then, pass that to a .bat file

servers.txt

server1
server2
server3

Open in new window


makerdp.bat

for /f %%a in (servers.txt) do echo mstsc /v:TERMSRV/%%a>rdp_%%a.bat

Open in new window


Run makerdp.bat to make the rdp_server*.bat files.
Avatar of bbimis

ASKER

thanks for the help.