加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

从PowerShell访问Windows凭据管理器

发布时间:2020-12-13 20:46:57 所属栏目:Windows 来源:网络整理
导读:我在Windows Server 2008 R2上使用PowerShell 2.0(因SP2010而必需).我需要从Windows Credential Manager检索进程的凭据.我似乎无法使其发挥作用. 我得到了这段代码: [Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType
我在Windows Server 2008 R2上使用PowerShell 2.0(因SP2010而必需).我需要从Windows Credential Manager检索进程的凭据.我似乎无法使其发挥作用.

我得到了这段代码:

[Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
(new-object Windows.Security.Credentials.PasswordVault).RetrieveAll() | % { $_.RetrievePassword(); $_ }

这两行代码都会抛出错误

Windows.Security.Credentials.PasswordVault,ContentType=WindowsRuntime : Unable to find type [Windows.Security.Credentials.PasswordVault,ContentType=WindowsRuntime]: make sure that the assembly containing this type is loaded.

(new-object Windows.Security.Credentials.PasswordVault).RetrieveAll() | % {$_.RetrievePassword(); $_ }

分别.我一直试图以某种方式导入PasswordVault类.到目前为止谷歌已经让我失望了,我甚至都没能找到它所在的大会.我错过了什么?

在powershell5类型中:
Install-Module CredentialManager -force

然后

New-StoredCredential -Target $url -Username $ENV:Username -Pass ....

然后

Get-StoredCredential -Target ....

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读