Skip to content

Instantly share code, notes, and snippets.

@avitsidis
Created February 15, 2017 13:52
Show Gist options
  • Save avitsidis/b9dc982303ecf7490a71edfdd73a0f57 to your computer and use it in GitHub Desktop.
Save avitsidis/b9dc982303ecf7490a71edfdd73a0f57 to your computer and use it in GitHub Desktop.
Disable Hyper-V VM PXE Boot
param(
[Parameter(Mandatory=$true)][string]$VMName,
[Parameter(Mandatory=$false)][string]$ComputerName = $env:computerName
)
#based on http://serverfault.com/questions/619763/can-pxe-boot-of-hyper-v-vms-be-disabled
$old_boot_order = Get-VMFirmware -VMName $VMName -ComputerName $ComputerName | Select-Object -ExpandProperty BootOrder
$new_boot_order = $old_boot_order | Where-Object { $_.BootType -ne "Network" }
Set-VMFirmware -VMName $VMName -ComputerName $ComputerName -BootOrder $new_boot_order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment