My Windows 10 host is set to start a VirtualBox Virtual Machine in headless mode on startup. I have the VM configured to bridged mode, so it gets its own IP address. I then SSH to it from the Windows Terminal, so I don't need to see or use the VirtualBox GUI. Sometimes, however, the network interface misbehaves and I cannot connect to the VM, even after a VM reset.
What I found is that changing the adapter to NAT and then back to bridged, fixes the problem. But it means having to go to the GUI, so now I want to do it on the command line, so I can just run a script.
This is how I change it to NAT on the terminal prompt:
& 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' controlvm VMName nic1 nat
The above works fine, but if I try changing it back to bridged:
& 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' controlvm VMName nic1 bridged
VBoxManage.exe: error: Missing argument to 'bridged'
I totally get the error, on the UI, there's a drop-down where I select the network connection, in my case "Intel(R) Wi-Fi 6 AX201 160MHz". How do I specify it on the CLI?