I was struggling on how to have the BT working in VirtualBox automatically (PC boot > VM launched > BT Enabled), I’ve spent a full day to figure the logic behind it and finally come to a solution.
First of all: the VM can’t get the control of the BT interface if it’s being used by the host OS (Windows), so after have configured the adapter in the VirtualBox configuration and have launched the VM, you need to “disable” (or physically remove it from the USB port if it’s a dongle), then enable it back, only then VirtualBox will take the priority over windows and will finally see the interface.
But how to automatize the above? With a batch file, I’ve just added the commands to disable and enable the BT interface after the VM startup. This is the batch I’m currently kicking on boot:
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm HASS
timeout 10
wmic path Win32_PnPEntity where "name='Generic Bluetooth Radio'" call disable
timeout 5
wmic path Win32_PnPEntity where "name='Generic Bluetooth Radio'" call enable
“Generic Bluetooth Radio” is the device name of my device in the Device Manager, change it accordinly. Be aware, the batch must be run with Administrator privileges.