Set Hyper-V Boot Order with PowerShell

By default new VMs are created with a network adapter as the primary boot device. If you want to boot from DVD image, then HDD, as I do most of the time. It's a bit cumbersome, but you can do that in bulk with:

Get-VM | Get-VMFirmware | ForEach-Object {
    $boot = $_.BootOrder
    $dvd = $boot.Device | Where-Object {$_ -is "Microsoft.HyperV.PowerShell.DvdDrive"} | Select-Object -First 1
    $hdd = $boot.Device | Where-Object {$_ -is "Microsoft.HyperV.PowerShell.HardDiskDrive"} | Select-Object -First 1

   Set-VMFirmware -VMName $_.VMName -BootOrder $dvd,$hdd