我在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 ....
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。