新的 Vagrant Packaged Windows Server 2016 返回身份验证失败。正在重试

新的 Vagrant Packaged Windows Server 2016 返回身份验证失败。正在重试

我正在使用 Windows Server 2016 创建基础映像。该映像已完全修补并应用了所有正常配置,但是当我测试它时,它无法以 vagrant 用户身份连接,并显示一条消息,根据 Google 搜索,它正在尝试使用 SSH,尽管对话框中列出了 WinRM。

我已经把我的构建文档放在github以供参考。

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'WindowsDocker'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: temp_default_1489982222856_48671
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 5985 (guest) => 55985 (host) (adapter 1)
    default: 5986 (guest) => 55986 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: WinRM address: 127.0.0.1:55985
    default: WinRM username: vagrant
    default: WinRM execution_time_limit: PT2H
    default: WinRM transport: negotiate
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

注意:一旦盒子启动,我可以手动连接到使用 WinRM 吗?

$securePassword = ConvertTo-SecureString 'vagrant' -asplaintext -force
$cred = New-Object System.Management.Automation.PSCredential ('vagrant', $securePassword)
enter-pssession 127.0.0.1 -port 55985 -Auth CredSSP -credential $cred
[127.0.0.1]: PS C:\Users\vagrant\Documents> exit

平台详细信息

  • 主机是 Windows 10
  • Vagrant 版本是 1.9.2
  • Oracle VirtualBox 5.1.18
  • Guest 是 Windows Server 2016 标准评估版

注意:在 Vagrant 1.9.1 中,客人会被销毁......

    default: WinRM transport: negotiate
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-1.8.1/lib/winrm/http/response_handler.rb:57:in `raise_if_auth_error': WinRM::WinRMAuthorizationError (WinRM::WinRMAuthorizationError)

答案1

所以事实证明我并没有禁用用户帐户控制(UAC),我已将以下内容添加到我的工作表中。

reg add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /d 0 /t REG_DWORD /f /reg:64

相关内容