1234567891011121314151617181920212223242526272829303132 |
- # AddBootOptionNoHyperV.ps1
- # Create a boot option with Hyper-V turned off
- # Variables
- $description = "Windows 10 Pro -"
- # Before doing anything, check if the boot option already exists
- $already_added = bcdedit /enum | Select-String "VirtualBox"
- If("$already_added" -ne "") {
- Write-Host "VirtualBox boot entry already added -- bailing out"
- Exit
- }
- # First, rename the current boot option to "[...] - Hyper V"
- bcdedit /set "{current}" description "$description Hyper-V"
- # Create a copy of the current boot option
- bcdedit /copy "{current}" /d "$description VirtualBox"
- # Get the name of the new boot option (assumed to be the last one
- # listed by `bcdedit /enum`)
- $vboxboot_guid = bcdedit /enum `
- | Select-String "description" -Context 3,0 `
- | % { $_.Context.PreContext[0] -replace '^identifier +'} `
- | Select -Last 1
- # Turn off the hypervisor for the new boot entry
- bcdedit /set "$vboxboot_guid" hypervisorlaunchtype off
- # Make VirtualBox the default boot entry
- bcdedit /default "$vboxboot_guid"
|