从PowerShell访问Windows凭据管理器

前端之家收集整理的这篇文章主要介绍了从PowerShell访问Windows凭据管理器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在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 ....

猜你在找的Windows相关文章