Yes.
Listing vms (to get the name)
$ VBoxManage list vms
"Debian_11_Server_64bit" {3d**6e14-3846-4673-aacb-726****283af}
"emptyVM" {8a**643a-f470-4ab0-931a-5da6****5ce4}
- Enable/disable VRDP when the VM is OFF
# Power off
$ vboxmanage controlvm emptyVM poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
# Turn off VRDP
$ VBoxManage modifyvm emptyVM --vrde off
# Turn on VRDP
$ VBoxManage modifyvm emptyVM --vrde on
- Enable/disable VRDP when the VM is ON (or OFF)
# We start the VM
$ vboxmanage startvm emptyVM --type headless
Waiting for VM "emptyVM" to power on...
VM "emptyVM" has been successfully started.
# Try the previous command
$ VBoxManage modifyvm emptyVM --vrde on
VBoxManage: error: The machine 'emptyVM' is already locked for a session (or being unlocked)
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 640 of file VBoxManageModifyVM.cpp
The VRDP settings cannot be changed with "modifyvm" when the VM is ON.
But we can still change them with "controlvm".
$ VBoxManage controlvm emptyVM vrde off
$ VBoxManage controlvm emptyVM vrde on
- How can I know if it is enabled / disabled and the port?
$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE: enabled (Address 0.0.0.0, Ports 3394, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE port: 3394
VRDE property : TCP/Ports = "3394"
VRDE property : TCP/Address = <not set>
VRDE property : VideoChannel/Enabled = <not set>
VRDE property : VideoChannel/Quality = <not set>
VRDE property : VideoChannel/DownscaleProtection = <not set>
VRDE property : Client/DisableDisplay = <not set>
VRDE property : Client/DisableInput = <not set>
VRDE property : Client/DisableAudio = <not set>
VRDE property : Client/DisableUSB = <not set>
VRDE property : Client/DisableClipboard = <not set>
VRDE property : Client/DisableUpstreamAudio = <not set>
VRDE property : Client/DisableRDPDR = <not set>
VRDE property : H3DRedirect/Enabled = <not set>
VRDE property : Security/Method = <not set>
VRDE property : Security/ServerCertificate = <not set>
VRDE property : Security/ServerPrivateKey = <not set>
VRDE property : Security/CACertificate = <not set>
VRDE property : Audio/RateCorrectionMode = <not set>
VRDE property : Audio/LogPath = <not set>
VRDE Connection: not active
- How can I change the PORT
$ vboxmanage controlvm emptyVM vrdeport 12345
- Does the change done with "controlvm" persist when the VM is powered
off?
Below we poweroff the VM, disable VRDP, poweron, modify VRDP, poweroff and check. Apparently, the change is persistent.
$ vboxmanage controlvm emptyVM poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
$ VBoxManage modifyvm emptyVM --vrde off
$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE: disabled
$ vboxmanage startvm emptyVM --type headless
Waiting for VM "emptyVM" to power on...
VM "emptyVM" has been successfully started.
$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE: disabled
VRDE Connection: not active
$ vboxmanage controlvm emptyVM vrde on vrdeport 12345
$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE: enabled (Address 0.0.0.0, Ports 12345, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE port: 12345
VRDE property : TCP/Ports = "12345"
VRDE property : TCP/Address = <not set>
VRDE property : VideoChannel/Enabled = <not set>
VRDE property : VideoChannel/Quality = <not set>
VRDE property : VideoChannel/DownscaleProtection = <not set>
VRDE property : Client/DisableDisplay = <not set>
VRDE property : Client/DisableInput = <not set>
VRDE property : Client/DisableAudio = <not set>
VRDE property : Client/DisableUSB = <not set>
VRDE property : Client/DisableClipboard = <not set>
VRDE property : Client/DisableUpstreamAudio = <not set>
VRDE property : Client/DisableRDPDR = <not set>
VRDE property : H3DRedirect/Enabled = <not set>
VRDE property : Security/Method = <not set>
VRDE property : Security/ServerCertificate = <not set>
VRDE property : Security/ServerPrivateKey = <not set>
VRDE property : Security/CACertificate = <not set>
VRDE property : Audio/RateCorrectionMode = <not set>
VRDE property : Audio/LogPath = <not set>
VRDE Connection: not active
$ vboxmanage controlvm emptyVM poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE: enabled (Address 0.0.0.0, Ports 12345, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE property : TCP/Ports = "12345"
VRDE property : TCP/Address = <not set>
VRDE property : VideoChannel/Enabled = <not set>
VRDE property : VideoChannel/Quality = <not set>
VRDE property : VideoChannel/DownscaleProtection = <not set>
VRDE property : Client/DisableDisplay = <not set>
VRDE property : Client/DisableInput = <not set>
VRDE property : Client/DisableAudio = <not set>
VRDE property : Client/DisableUSB = <not set>
VRDE property : Client/DisableClipboard = <not set>
VRDE property : Client/DisableUpstreamAudio = <not set>
VRDE property : Client/DisableRDPDR = <not set>
VRDE property : H3DRedirect/Enabled = <not set>
VRDE property : Security/Method = <not set>
VRDE property : Security/ServerCertificate = <not set>
VRDE property : Security/ServerPrivateKey = <not set>
VRDE property : Security/CACertificate = <not set>
VRDE property : Audio/RateCorrectionMode = <not set>
VRDE property : Audio/LogPath = <not set>