runas/savecred ...不接受cmdkey/add(凭证) [英] runas /savecred... don't accept cmdkey /add (credentials)

查看:731
本文介绍了runas/savecred ...不接受cmdkey/add(凭证)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 runas/savecred ... cmdkey/add ...有问题.
我有一个批处理文件包含以下行:

I have a problem with runas /savecred ... and cmdkey /add....
I have a batch file contains this line:

runas /profile /savecred /user:MyDomain\MyUserName "MyProgram.exe"  

我以管理员身份登录到计算机,并希望与另一个用户MyUserName执行MyProgram.exe.
当启动启动批处理文件时,它会提示输入MyUserName的密码,然后键入密码,效果很好!!!
第二次,它不需要输入密码,因为/savecred 已在Windows凭据中保存了MyUserName和密码.酷!
凭据管理器中的信息

I'm logging to my computer as Administrator and I want to execute MyProgram.exe with another user: MyUserName.
When I launch my batch file the firt time, it prompts for password for MyUserName, I type the password and it works nice !!!
For second time, it don't ask for password because /savecred has saved MyUserName and password in Windows Credential. cool !!
The information in Credential Manager

Internet or network adress: MyDomain\MyUserName (Interactive logon)  
User name: MyDomain\MyUserName  
Password: ............
Persistence: Logon Session  

现在,我要避免输入第一次输入的密码.为此,我使用cmdkey.exe在此行中添加了自己的凭据,而无需/savecred

Now, I would like to avoid to type the password asked for the first time. For this I have used cmdkey.exe to add credential myself without /savecred by this line

cmdkey /add:domain:interactive=MyDomain\MyUserName /user:MyDomain\MyUserName /pass:***********  

并且我从行 runas
中删除了/savecred 凭据管理器中的信息

and i have removed /savecred from line runas
The information in Credential Manager

Internet or network adress: MyDomain\MyUserName  
User name: MyDomain\MyUserName  
Password: ............
Persistence: Logon Session  

第一行中没有(交互式登录).问题是当我启动批处理文件时,它总是提示您键入密码,好像运行符会舍弃cmdkey保存的信息!

Look there is no (Interactive logon) in the first line. The poblem is when I launch the batch file, it prompt always to type password, it seems like the runas disacard the informaion saved by cmdkey !

那么我错过了什么?还是/savecred保存在Windows凭据中的其他内容?

So What I have missed? Or what other things that /savecred save in the Windows Credentials?

推荐答案

在Windows 7下,runas/savecred(交互式登录)凭据保存在目录c:\ users \ username \ appdata \ roaming \中的HIDDEN文件中. microsoft \凭据.

Under windows 7, the runas/savecred (interactive logon) credential is saved in a HIDDEN file in the directory c:\users\username\appdata\roaming\microsoft\credentials.

如果将此文件移出该目录,则Windows凭据管理器中不会显示该凭据.将文件移回到引用的目录,然后重新出现凭据.无需其他操作或调整.

If you move this file out of this directory, the credential is not displayed in the Windows credential manager. Move the file back into the referenced directory, and the credential reappears. No other manipulation or tweaking is necessary.

您应该通过运行一次runas/savecred命令来保存交互式登录,然后根据需要将隐藏的加密文件移入和移出.

You should save the interactive logon by running the runas /savecred command once and then moving the hidden encrypted file in and out as needed.

这篇关于runas/savecred ...不接受cmdkey/add(凭证)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆