VMware Workstation 和 Device/Credential Guard 不兼容

VMware Workstation and Device/Credential Guard are not compatible

去年我一直在 运行 VMware 没问题,今天我打开它启动我的一个 VM 并收到一条错误消息,请看屏幕截图。

我确实按照 link 完成了这些步骤,在第 4 步我需要使用 "mountvol" 挂载一个卷。 当我尝试使用 mountvol X: \?\Volume{5593b5bd-0000-0000-0000-c0f373000000}\ 挂载卷时,它一直说 The directory is not empty. 我什至创建了一个 2GB 的分区,但仍然显示相同的消息。

我的问题:

如何挂载非空的卷,即使它是空的?

为什么这个 Device/Credential Guard 会自动启用它,我该如何摆脱它或禁用它。

命令:

Device/Credential Guard is a Hyper-V based Virtual Machine/Virtual Secure Mode 托管安全内核,使 Windows 10 更加安全。

...the VSM instance is segregated from the normal operating system functions and is protected by attempts to read information in that mode. The protections are hardware assisted, since the hypervisor is requesting the hardware treat those memory pages differently. This is the same way to two virtual machines on the same host cannot interact with each other; their memory is independent and hardware regulated to ensure each VM can only access it’s own data.

From here, we now have a protected mode where we can run security sensitive operations. At the time of writing, we support three capabilities that can reside here: the Local Security Authority (LSA), and Code Integrity control functions in the form of Kernel Mode Code Integrity (KMCI) and the hypervisor code integrity control itself, which is called Hypervisor Code Integrity (HVCI).

When these capabilities are handled by Trustlets in VSM, the Host OS simply communicates with them through standard channels and capabilities inside of the OS. While this Trustlet-specific communication is allowed, having malicious code or users in the Host OS attempt to read or manipulate the data in VSM will be significantly harder than on a system without this configured, providing the security benefit.

Running LSA in VSM, causes the LSA process itself (LSASS) to remain in the Host OS, and a special, additional instance of LSA (called LSAIso – which stands for LSA Isolated) is created. This is to allow all of the standard calls to LSA to still succeed, offering excellent legacy and backwards compatibility, even for services or capabilities that require direct communication with LSA. In this respect, you can think of the remaining LSA instance in the Host OS as a ‘proxy’ or ‘stub’ instance that simply communicates with the isolated version in prescribed ways.


Hyper-V 和 VMware 直到 2020, when VMware used Hyper-V Platform to co-exist with Hyper-V starting with Version 15.5.5 才同时工作

How does VMware Workstation work before version 15.5.5?

VMware Workstation traditionally has used a Virtual Machine Monitor (VMM) which operates in privileged mode requiring direct access to the CPU as well as access to the CPU’s built in virtualization support (Intel’s VT-x and AMD’s AMD-V). When a Windows host enables Virtualization Based Security (“VBS“) features, Windows adds a hypervisor layer based on Hyper-V between the hardware and Windows. Any attempt to run VMware’s traditional VMM fails because being inside Hyper-V the VMM no longer has access to the hardware’s virtualization support.

Introducing User Level Monitor

To fix this Hyper-V/Host VBS compatibility issue, VMware’s platform team re-architected VMware’s Hypervisor to use Microsoft’s WHP APIs. This means changing our VMM to run at user level instead of in privileged mode, as well modifying it to use the WHP APIs to manage the execution of a guest instead of using the underlying hardware directly.

What does this mean to you?

VMware Workstation/Player can now run when Hyper-V is enabled. You no longer have to choose between running VMware Workstation and Windows features like WSL, Device Guard and Credential Guard. When Hyper-V is enabled, ULM mode will automatically be used so you can run VMware Workstation normally. If you don’t use Hyper-V at all, VMware Workstation is smart enough to detect this and the VMM will be used.

System Requirements

To run Workstation/Player using the Windows Hypervisor APIs, the minimum required Windows 10 version is Windows 10 20H1 build 19041.264. VMware Workstation/Player minimum version is 15.5.5.

为避免错误,请将您的 Windows 10 更新到版本 2004/Build 19041(Mai 2020 更新)并至少使用 VMware 15.5.5

有更好的方法来处理这个问题。无需完全删除 Hyper-V,您只需创建备用引导以在需要使用 VMWare 时暂时禁用它。如图所示...

http://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx

C:\>bcdedit /copy {current} /d "No Hyper-V" 
The entry was successfully copied to {ff-23-113-824e-5c5144ea}. 

C:\>bcdedit /set {ff-23-113-824e-5c5144ea} hypervisorlaunchtype off 
The operation completed successfully.

注意:第一个命令生成的 ID 是您在第二个命令中使用的 ID。不要只是 运行 逐字逐句。

重新启动后,您将只看到一个包含两个选项的菜单...

  • Windows 10
  • 没有Hyper-V

因此,使用 VMWare 只需重新启动并选择否 Hyper-V 选项即可。

如果你想再次删除引导项。您可以使用 bcdedit 的 /delete 选项。

首先,获取当前启动项的列表...

C:\>bcdedit /v

这列出了所有条目及其 ID。复制相关ID,然后像这样删除...

C:\>bcdedit /delete {ff-23-113-824e-5c5144ea}

如评论中所述,您需要从提升的命令提示符而不是 powershell 执行此操作。在 powershell 中,命令会出错。

更新: 如果花括号用反引号 (`) 转义,则可以在 powershell 中 运行 这些命令。像这样...

C:\WINDOWS\system32> bcdedit /copy `{current`} /d "No Hyper-V"

我仍然不相信 Hyper-V 适合我,即使经历了去年的 Docker 考验和磨难,我猜你不会想要非常频繁地切换,所以与其创建新启动并确认启动默认值或等待每次启动超时我在管理员模式下按需在控制台中切换

bcdedit /set hypervisorlaunchtype off

这样做 post 的另一个原因 -- 让您省去一些麻烦:您认为您再次使用 "on" 参数打开了 Hyper-V?没有。对于 MiRKoS..t 来说太简单了。这是自动

玩得开心!
G.

我也为这个问题苦苦挣扎。该线程中的答案很有帮助,但不足以解决我的错误。您将需要像其他答案所建议的那样禁用 Hyper-V 和 Device guard。有关更多信息,请参阅 here.

除了上面提供的答案之外,我还包括需要完成的更改。最终帮助我的 link 是 this.

我的回答将仅总结其余答案(即禁用 Hyper-V 和 Device guard)与以下步骤之间的区别:

  1. 如果您使用了组策略,请禁用您使用的组策略设置 用于启用 Windows Defender Credential Guard(计算机 配置 -> 管理模板 -> 系统 -> Device Guard -> 打开基于虚拟化的安全性)。
  2. 删除以下注册表设置:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\LSA\LsaCfgFlags HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\EnableVirtualizationBasedSecurity HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\RequirePlatformSecurityFeatures

    重要: 如果您手动删除这些注册表设置,请确保删除 商场。如果您不全部删除它们,设备可能会进入 BitLocker 恢复。

  3. 使用删除 Windows Defender Credential Guard EFI 变量 编辑。从提升的命令提示符(以管理员模式启动),键入 以下命令:

     mountvol X: /s
    
     copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
    
     bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
    
     bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
    
     bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
    
     bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO
    
     bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:
    
     mountvol X: /d
    
  4. 重启电脑。

  5. 接受提示以禁用 Windows Defender Credential Guard。

  6. 或者,您可以禁用基于虚拟化的安全性 关闭 Windows Defender Credential Guard 的功能。

让它超级简单:

  1. 只需 download this script 直接来自 Microsoft。

  2. 运行你的Powershell作为管理员然后执行以下命令:

    • 验证 DG/CG 是否启用 DG_Readiness.ps1 -Ready
    • 禁用 DG/CG。 DG_Readiness.ps1 -Disable

如果您始终保持开放的自定义 "Run as administrator" 命令提示符或 powershell 命令行 window,您可以选择设置以下别名/宏以简化执行提到的命令@gue22 用于在需要使用 vmware 播放器或工作站时简单地禁用 hyper-v 管理程序,然后在完成后再次启用它。

doskey hpvEnb = choice /c:yn /cs /d n /t 30 /m "Are you running from elevated command prompt" ^& if not errorlevel 2 ( bcdedit /set hypervisorlaunchtype auto ^& echo.^&echo now reboot to enable hyper-v hypervisor )
doskey hpvDis = choice /c:yn /cs /d n /t 30 /m "Are you running from elevated command prompt" ^& if not errorlevel 2 ( bcdedit /set hypervisorlaunchtype off ^& echo.^&echo now reboot to disable hyper-v hypervisor )
doskey bcdL = bcdedit /enum ^& echo.^&echo now see boot configuration data store {current} boot loader settings

有了上面的内容,您只需键入 "hpvenb" [启动时启用管理程序]、"hpvdis" [启动时禁用管理程序] 和 "bcdl" [启动配置设备列表] 命令即可执行开、关、列表命令。

好吧,男孩女孩们,在深夜阅读了版本 17093 的发行说明后,我发现了影响我的 VMware Workstation VM 导致它们无法工作的更改点,它是设置 中 windows 安全(windows 防御者页面的新名称)下设备安全下的核心隔离设置。

默认情况下它是打开的,但是当我关闭它并重新启动我的电脑时,我的所有 VMware VM 都恢复正常工作。也许可以在下一个版本中加入按设备选项,以允许我们测试单个设备/应用程序响应,以允许根据需要打开或关闭每个设备或应用程序的核心隔离。

解决此问题的最简单方法是下载 "Device Guard and Credential Guard hardware readiness tool" 以更正不兼容问题:

我不知道为什么 DG_Readiness_Tool 的 3.6 版对我不起作用。 重新启动笔记本电脑后,问题仍然存在。 我一直在寻找解决方案,最后我遇到了 3.7 版的 工具,这次问题消失了。 您可以在这里找到最新的 powershell 脚本:

DG_Readiness_Tool_v3.7

对于最近对涉及 Hyper-V 的计算机进行更改可能会遇到此问题的用户,您需要在使用 VMWare 或 VirtualBox 时禁用它。他们不一起工作。 Windows Sandbox 和 WSL 2 需要开启 Hyper-V Hypervisor,这目前会破坏 VMWare。基本上,您需要 运行 下一次重启时 enable/disable Hyper-V 服务的命令。

要禁用 Hyper-V 并让 VMWare 工作,在 PowerShell 中以管理员身份:

bcdedit /set hypervisorlaunchtype off

要暂时重新启用 Hyper-V 并中断 VMWare,请以管理员身份在 PowerShell 中:

bcdedit /set hypervisorlaunchtype auto

之后您需要重新启动。我已经编写了一个 PowerShell 脚本,可以为您切换并通过对话框确认。它甚至可以使用 this technique 自行提升为管理员,这样您只需右键单击并 运行 脚本即可快速更改您的 Hyper-V 模式。它也可以很容易地修改为重新启动,但我个人不希望这种情况发生。将其保存为管理程序。ps1 并确保你有 运行 Set-ExecutionPolicy RemoteSigned 以便你可以 运行 PowerShell 脚本。

# Get the ID and security principal of the current user account
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent();
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID);

# Get the security principal for the administrator role
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator;

# Check to see if we are currently running as an administrator
if ($myWindowsPrincipal.IsInRole($adminRole))
{
    # We are running as an administrator, so change the title and background colour to indicate this
    $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)";
    $Host.UI.RawUI.BackgroundColor = "DarkBlue";
    Clear-Host;
}
else {
    # We are not running as an administrator, so relaunch as administrator

    # Create a new process object that starts PowerShell
    $newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";

    # Specify the current script path and name as a parameter with added scope and support for scripts with spaces in it's path
    $newProcess.Arguments = "-windowstyle hidden & '" + $script:MyInvocation.MyCommand.Path + "'"

    # Indicate that the process should be elevated
    $newProcess.Verb = "runas";

    # Start the new process
    [System.Diagnostics.Process]::Start($newProcess);

    # Exit from the current, unelevated, process
    Exit;
}

Add-Type -AssemblyName System.Windows.Forms


$state = bcdedit /enum | Select-String -Pattern 'hypervisorlaunchtype\s*(\w+)\s*'


if ($state.matches.groups[1].ToString() -eq "Off"){

    $UserResponse= [System.Windows.Forms.MessageBox]::Show("Enable Hyper-V?" , "Hypervisor" , 4)

    if ($UserResponse -eq "YES" ) 
    {

        bcdedit /set hypervisorlaunchtype auto
        [System.Windows.Forms.MessageBox]::Show("Enabled Hyper-V. Reboot to apply." , "Hypervisor")

    } 

    else 

    { 

        [System.Windows.Forms.MessageBox]::Show("No change was made." , "Hypervisor")
        exit

    }

} else {

    $UserResponse= [System.Windows.Forms.MessageBox]::Show("Disable Hyper-V?" , "Hypervisor" , 4)

    if ($UserResponse -eq "YES" ) 
    {

        bcdedit /set hypervisorlaunchtype off
        [System.Windows.Forms.MessageBox]::Show("Disabled Hyper-V. Reboot to apply." , "Hypervisor")

    } 

    else 

    { 

        [System.Windows.Forms.MessageBox]::Show("No change was made." , "Hypervisor")
        exit

    }

}

这里有正确的说明,以便每个人都可以遵循。

  • 首先从此 link 下载 Device Guard 和 Credential Guard 硬件准备工具:https://www.microsoft.com/en-us/download/details.aspx?id=53337
  • 将 zip 文件夹内容解压到某个位置,例如:C:\guard_tool
  • 你会得到类似 ps1 扩展文件的副本文件名的文件,在我的例子中是 v3.6,所以它将是:DG_Readiness_Tool_v3.6.ps1

  • 接下来单击开始菜单并搜索 powershell,然后右键单击它并 运行 以管理员身份。

  • 之后会看到蓝色终端输入命令 cd C:\guard_tool ,替换掉 cd 之后的路径使用您提取的工具位置
  • 现在输入命令:.\DG_Readiness_Tool_v3.6.ps1 -Disable
  • 重启系统后
  • 当您的系统重新启动时,启动时间系统将显示黑色背景通知以确认您要禁用这些功能,因此请按 F3 确认。
  • 如果有帮助就+1 :)

每一步的快速解决方案:

修复了 VMware Workstation 在 Windows 10 主机上的错误 传输 (VMDB) 错误 -14:管道连接已断开。

今天我们将修复 windows 10 计算机上的 VMWare 错误。

  1. 在 运行 框中键入“gpedit”,然后转到 [ERROR SEE POINT 3]

1- 计算机配置

2- 管理模板

3- 系统 - Device Guard:如果没有 DEVICE GUARD:(下载 https://www.microsoft.com/en-us/download/100591 安装此 "c:\Program Files (x86)\Microsoft Group Policy\Windows 10 November 2019 Update (1909)\PolicyDefinitions" COPYc:\windows\PolicyDefinitions )

4- 打开基于虚拟化的安全性。 现在双击它和“禁用”

  1. 以管理员身份打开命令提示符并键入以下内容 gpupdate /force [如果你没有 DEVICE GUARD 就不要这样做,否则它会再次出现]

  2. 打开注册表编辑器,现在转到 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\DeviceGuard。添加一个名为 EnableVirtualizationBasedSecurity 的新 DWORD 值并将其设置为 0 以禁用它。 下一步转到 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\LSA。添加一个名为 LsaCfgFlags 的新 DWORD 值并将其设置为 0 以禁用它。

  3. 在 运行 框中,键入打开或关闭 Windows 功能,现在取消选中 Hyper-V 并重新启动系统。

  4. 以管理员身份打开命令提示符并键入以下命令

    bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader

    bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"

    bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
    
    bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS

    bcdedit /set hypervisorlaunchtype off

现在,重新启动系统

安装最新的vmware workstation>15.5.5版本

支持 Hyper-V 主机

With the release of VMware Workstation/Player 15.5. 5 or >, we are very excited and proud to announce support for Windows hosts with Hyper-V mode enabled! As you may know, this is a joint project from both Microsoft and VMware

https://blogs.vmware.com/workstation/2020/05/vmware-workstation-now-supports-hyper-v-mode.html

我安装了 VMware.Workstation.Pro.16.1.0

现在它解决了我的问题现在我同时使用 docker 和 vmware 即使我的 window Hyper-V 模式已启用

我遇到了同样的问题。我有 VMware Workstation 15.5.4 和 Windows 10 版本 1909,并安装了 Docker Desktop。

我是这样解决的:

  1. 安装新的 VMware Workstation 16.1.0
  2. 将我的 Windows 10 从 1909 更新为 20H2

正如 VMware 指南在此 link

中所说

If your Host has Windows 10 20H1 build 19041.264 or newer, upgrade/update to Workstation 15.5.6 or above. If your Host has Windows 10 1909 or earlier, disable Hyper-V on the host to resolve this issue.

现在 VMware 和 Hyper-V 可以同时存在,Docker 和 VMware 在我的Windows。

Windows 1909 (18363.1377)

就我而言 我使用的是 windows 1909,Device Guard 被禁用,Hyper V 也是如此。在尝试 docker 时我安装并启用了wsl2。从控制面板卸载 wsl 并从 powershell 禁用它后,我的 vmware 又开始工作了。

以下是禁用wsl的命令

运行 在 powershell 中作为管理员

dism.exe /online /disable-feature /featurename:Microsoft-Windows-子系统-Linux


卸载屏幕截图中显示的 WSL

重新启动系统