0

这本质上是这个问题的重新发布:“通过 WinRM 在新机器上访问 PasswordVault 时无法打开 Vault”

它很老了,我们不知道如何“撞”它,所以我们在这里重述......

在新的 Azure Windows 机器(服务器 2012r2)上输入 PS-Session 后,如下所示:

$username = 'print-dev'
$uri = 'somevm.eastus.cloudapp.azure.com'
$port = '5986'
$remote_address = "https://" + $uri + ":" + $port
$password = 'somepassword'
$pass = ConvertTo-SecureString -string $password -AsPlainText -Force
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $pass
Enter-PSSession -ConnectionUri  $remote_address -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck)


...我们运行以下命令并失败:

[somevm.eastus.cloudapp.azure.com]: PS C:\Users\print-dev\Documents> [Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime] 
$vault = New-Object Windows.Security.Credentials.PasswordVault 
$vault.RetrieveAll()

...结果如下:

Exception calling "RetrieveAll" with "0" argument(s): "Access is denied.
Cannot open Vault"
At line:1 char:1
+ $vault.RetrieveAll()
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : UnauthorizedAccessException

"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" 

如果我们 RDP 到具有相同用户 print-dev 的机器,调出控制台并以这种方式运行命令,我们就成功了。在第一次从 RDP 运行后,通过远程访问的后续调用也将成功。

我们如何解决这个拒绝访问错误?

在 RDP 会话中执行的 PowerShell 命令和同一用户在远程 PS-Session 中执行的 powershell 命令有什么区别?

任何帮助,将不胜感激!

4

0 回答 0