【问题标题】:Retrieving password from Windows Credential Manager using CMD使用 CMD 从 Windows 凭据管理器检索密码
【发布时间】:2015-04-12 19:17:07
【问题描述】:

我正在尝试使用命令提示符从 Windows 凭据管理器添加和检索凭据。

要添加新凭据,我有如下命令,它运行良好:

cmdkey /add:testTarget /user:testUser /pass:testPassword

但是,当我尝试检索之前使用 CMD 添加的凭据 (testTraget) 时,我无法使用以下命令获取密码:

cmdkey /list:testTarget

该命令只返回 Target(testTarget)、Type(Domain Password) 和 Username(testUser)

如何找回 testUser 密码?

我知道这在 Mac OS 中使用 Bash 和钥匙串是可能的。

【问题讨论】:

    标签: windows cmd command-line command-prompt credential-manager


    【解决方案1】:

    “如何找回 testUser 密码?”

    使用cmdkey 是不可能的。

    参考cmdkey

    创建、列出或删除存储的用户名、密码或凭据。

    ...

    密码一旦存储,就不会显示。

    【讨论】:

    • 问他们存储的目的是什么?
    • 现在我们知道我们不能使用 cmdkey 来做到这一点......应该能够与商店交互以检索密码......它是什么?
    • @user1885834 (耸耸肩)我不知道。
    • 我来这里是为了寻找相同的答案。在 macOS 上寻找类似 @​​987654323@ 的命令。
    【解决方案2】:

    可以使用 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 $pass
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-02
      • 2015-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-18
      相关资源
      最近更新 更多