我正在尝试使用命令提示符从Windows凭据管理器添加和检索凭据。
要添加新凭据,我使用如下命令,它可以很好地工作:
cmdkey /add:testTarget /user:testUser /pass:testPassword但是,当我尝试检索之前使用CMD添加的凭据(testTraget)时,无法使用以下命令获取密码:
cmdkey /list:testTarget该命令仅返回目标(TestTarget)、类型(域密码)和用户名(TestUser)
如何找回testUser密码?
我知道这在Mac OS中使用Bash和keychain是可能的。
发布于 2021-01-28 23:36:54
可以使用powershell和Credman.ps1库来处理cmdkey证书存储中的密码。
https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Credentials-d44c3cde
以系统用户的身份添加凭据(在管理员的powershell控制台中的psexec -s之后)。也以系统用户身份运行powershell脚本(即在任务调度器任务中),以便安全使用。
要了解有关Sysinternal的psExec和cmdkey的更多信息,请参阅以下答案:https://superuser.com/questions/1206443/how-to-add-cached-credentials-for-the-windows-system-acount
--
添加密码
cmdkey /generic:Foo /user:bar /pass:banana使用powershell检索明文密码的
. "Credman.ps1"
$CredKey = "Foo"
$sourceCredential = Read-Creds $CredKey
$pass = $sourceCredential.CredentialBlob.tostring()
write-host $passhttps://stackoverflow.com/questions/28470945
复制相似问题