我在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 ....