查看是否开启Hyper-V,另附开启关闭代码
打开管理员权限的终端
使用以下代码查看是否开启Hyper-V
$hyperv = Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online
# Check if Hyper-V is enabled
if($hyperv.State -eq "Enabled") {
Write-Host "Hyper-V is enabled."
} else {
Write-Host "Hyper-V is disabled."
}
使用以下代码开启Hyper-V,然后重启
bcdedit /set hypervisorlaunchtype auto
使用以下代码关闭Hyper-V,然后重启
bcdedit /set hypervisorlaunchtype off
标签:Hyper,查看,代码,开启,另附,关闭
From: https://www.cnblogs.com/jonil/p/17551967.html