Skip to main content

Assigning different VRDP ports to all my VMs

Hint of the day: how to enable VRDP on all the VirtualBox VMs and assign a different VRDP port to each of them, so they don't collide:

j=0
for vm in `VBoxManage list vms | awk '/^\"/ {print $1}' | sed 's/\"//g'`; do
     k=`printf %02d $j`
     VBoxManage modifyvm "$vm" --vrdp on --vrdpport 389"$k"
     j=$((j+1))
done
Of course, if you have more than 99 VMs, the printf would look slightly different :-)