runas with the /savecred switch does not accept a credential stored by the cmdkey command
Hello, I am trying to automate the storing of a credential to several people's profiles on several servers so they can use it with scripts they will be running that have the "runas" command with the /savecred switch. I am using the "cmdkey" command to store the user and password but when the runas command is executed, it prompts for the password anyway. I know the /savecred works since if I let the runas command prompt for the password and I enter it, on subsequent executions, it no longer asks for the password. Interestingly enough, if I use the cmdkey command to overwrite the stored credential, runas will prompt again for the password so it can store it itself. Almost like runas doesn't "trust" cmdkey. Any thoughts on why this may be happening and how I can get around it? I really need to automate the storing of the credential or it will take a couple hundred manual executions of the runas command to get it store on all the people's profiles that need it.
May 24th, 2012 9:54am

Hi, If you prefer to do all your credentials management from the command line, take a look at the new CMDKEY utility. This utility creates, displays, and deletes credentials in the credentials cache. Meanwhile, I'd like to share a useful article for your reference: Password Security http://www.progettista.ru/0735711585_ch11lev1sec4.shtml Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information. Hope this helps! Best Regards Elytis Cheng TechNet Subscriber Support If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.Elytis Cheng TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
May 25th, 2012 3:58am

Hi, Thanks for posting in Microsoft TechNet forums. As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as Answered as the previous steps should be helpful for many similar scenarios. If the issue still persists, please feel free to reply this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish. BTW, wed love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems. Thanks for your understanding and efforts. Best Regards Elytis ChengElytis Cheng TechNet Community Support
May 29th, 2012 5:21am

Elytis, Thanks for the additional info. I understand the CMDKEY command and have tried it but it seems that RUNAS does not "trust" the credential stored but CMDKEY. The steps I have followed are: 1) execute the CMDKEY command storing the ID and password 2) verify the credential exists with CMDKEY /list 3) execute the RUNAS command providing the same ID and the /savecred switch At that point, RUNAS prompts for the password. After entering the password for RUNAS, subsequent executions of the same RUNAS command do not prompt for the password. As a test, if I try saving the credential again using CMDKEY, the next execution of the RUNAS command will prompt for the password one more time. It is as though CMDKEY is not properly storing the credential for RUNAS or RUNAS is looking for something more than CMDKEY creates. Any other thoughts? RS
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2012 9:15am

Hello, Thank you for your post. This is a quick note to let you know that we are performing research on this issue. Best Regards Elytis Cheng Elytis Cheng TechNet Community Support
June 4th, 2012 5:45am

Hi, i have made a test in my lab below: 1. log on to a Win 7 with standard user and run following command: Runas /savecred /user:A\administrator notepad 2. i'm prompted for a password for administator and then enter the password. 3. i run following command again and i'm not prompted for a password. Runas /savecred /user:A\administrator notepad 4. i run following command to add credentials. Cmdkey /add:mycomputername /user:a\administrator /password:pass! 3. i run following command again and i'm not prompted for a password. Runas /savecred /user:A\administrator notepad The results is different as yours, so please give me your exactly steps. Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
June 6th, 2012 5:42am

Hi, please refer to following thread: http://social.technet.microsoft.com/Forums/en-IN/winservergen/thread/50475105-4773-4a98-95f3-80d7f9bcd480Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
June 6th, 2012 5:44am

Jason, Thanks for the response. I noticed you tried this under Windows 7 but I am having this problem under Windows 2003 R2. I will try your steps under Win 7 just to see if I get different resullts and get back.
Free Windows Admin Tool Kit Click here and download it now
June 8th, 2012 2:03pm

Jason, Sorry for the delay - other priorities took over. At any rate, I tested this as mentioned last week. The CMDKEY procedure does work under Windows 7 however it does not work under Win 2K3 SP2. After entering the CMDKEY command, an attempt to do another RUNAS results in another password prompt. Any other ideas? RS
June 15th, 2012 11:00am

HI, please provide your details steps so that i can make a test in my lab. thanks !Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
June 18th, 2012 5:37am

Jason, Here is the contents of my session on a Windows 2003 server: Microsoft Windows [Version 5.2.3790] (C) Copyright 1985-2003 Microsoft Corp. C:\Documents and Settings\rsmith>cmdkey /list Currently stored credentials: * NONE * C:\Documents and Settings\rsmith>cmdkey /add:inspro\svc_batch /user:inspro\svc_b atch /password:xxxxxx CMDKEY: Credential added successfully. C:\Documents and Settings\rsmith>runas /savecred /user:inspro\svc_batch notepad Attempting to start notepad as user "inspro\svc_batch" ... Enter the password for inspro\svc_batch: Attempting to start notepad as user "inspro\svc_batch" ... C:\Documents and Settings\rsmith>cmdkey /list Currently stored credentials: Target: inspro\svc_batch Type: Domain Password User: inspro\svc_batch C:\Documents and Settings\rsmith>cmdkey /add:inspro\svc_batch /user:inspro\svc_b atch /password:xxxxxxxx CMDKEY: Credential added successfully. C:\Documents and Settings\rsmith>cmdkey /list Currently stored credentials: Target: inspro\svc_batch Type: Domain Password User: inspro\svc_batch C:\Documents and Settings\rsmith>runas /savecred /user:inspro\svc_batch notepad Attempting to start notepad as user "inspro\svc_batch" ... Enter the password for inspro\svc_batch: Attempting to start notepad as user "inspro\svc_batch" ... C:\Documents and Settings\rsmith> 1) I do a CMDKEY list to show there are no IDs/passwords stored. 2) I do a CMDKEY to store the user and password (the password has been masked for my protection) 3) I do a RUNAS with the "savecred" parameter and am reqested to enter the password again and notepad launches 4) I do a CMDKEY list to show the RUNAS stored credential 5) I do a CMDKEY to store the user and password again (the password has been masked for my protection) 6) I do a CMDKEY list to show the stored credential 7) I try another RUNAS but it prompts for the password again and notepad launches That's pretty much it. Seems that RUNAS does not want to accept a credential stored by CMDKEY - at least not on Win 2K3. I know you might be thinking I entered the password wrong but I tried it several times to make sure. Thanks again for any help, Bob
June 20th, 2012 11:10pm

Hi, I have made a test in my lab, and the results is same as yours. Also, I have checked the saved crendentials in crendentials manager. It seems the crendentials saved by cmdkey is different with the one saved by runas /savecred. The screeshot below shows us the crendentials save by cmdkey. below is the one saved by runas. Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2012 3:59am

Hi, I have made a test in my lab, and the results is same as yours. Also, I have checked the saved crendentials in crendentials manager. It seems the crendentials saved by cmdkey is different with the one saved by runas /savecred. The screeshot below shows us the crendentials save by cmdkey. below is the one saved by runas. Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
June 22nd, 2012 3:59am

Jason, So am I out of luck here? Seems it works fine with Win 7 but not Win 2K3, so perhaps it's a bug? Is there any way I can work around this or pehaps edit the credential somwhow to make it acceptable to RUNAS? Regards, Bob
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2012 8:53am

Hi, I perform the steps as you mentioned above on windows 7 and got same results as yours, it is not worked on Win 7 as well. Besides, your steps are different with the one I provided before. Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
June 26th, 2012 6:37am

HI, How are things going on your end? Please keep me posted on this issue. I certainly appreciate your time.Best regards, Jason Mei Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
July 10th, 2012 5:42am

Jason, I apologize for the lack of a response on this. I have been out of the office for several days. I will get back to this tomorrow with an update. Regards, Bob
July 18th, 2012 12:15pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics