%h1 Bhyve and Windows 2025

%p
  The Windows 2025 and Windows 11 Evaluation is fully functional, with the
  %em minor annoyance
  that it shuts down automatically after 1 hour.
  See also:
  automate configuration using
  = succeed '.' do
    %a{:href=>"http://scriptedconfiguration.org/formulas/windows.html"} rset(1)

%h2 VirtIO and Startup

%p
  To enable Windows networking we will need the
  = succeed '.' do
    %a{:href=>"https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers"} Windows VirtIO Drivers
  Convert the image using

:codeblock
  :::sh
  pkg install qemu
  qemu-img convert -f vhdx -O raw WinServer2025.vhdx winsrv2025.img
  fetch https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso

/
  qemu-img convert -f vmdk -O raw WinDev2404Eval-disk1.vmdk win11.img

%p.warning
  Converting
  %code vhdx
  to
  %code qcow2
  may not work. Try
  %code raw
  instead.

:codeblock
  :::sh
  kldload tpm
  name="winsrv2025"
  vncport="5907"
  bhyve -c 2 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-hd,/vm/$name.img \
        -s 4,ahci-cd,/vm/virtio-win.iso \
        -s 10,virtio-net,tap7,mac=00:0c:29:dc:df:79 \
        -s 29,fbuf,tcp=0.0.0.0:$vncport,w=800,h=600 \
        -s 30,xhci,tablet \
        -s 31,lpc \
        -l tpm,passthru,/dev/tpm0 \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
         $name

/
  Disable Firewall
  Set-NetFirewallProfile -All -Enabled False

  Set Hostname
  Rename-Computer -NewName "weval1" -Restart

  Expiration
  Set-LocalUser -Name "Administrator" -PasswordNeverExpires $true


/
  Disable vmware tools

  sc delete vmtools
  del "C:\Program Files\VMware"
  del "C:\Program Files\Common Files\VMware"
  del "C:\Program Data\VMware"

  Set-NetFirewallProfile -All -Enabled False

%h2 Caveats

%ul
  %li
    Performance is much worse on Bhyve than on bare metal.
  %li
    Windows Subsystem for Linux does not work since this requires support for
    nested vitalization.
