vboxmanage clonehd -format vdi "Virtual Disk.vmdk" vbox2.vdi
# Create & register a new virtual machine in virtualbox
vboxmanage createvm --name phd07 --register
# Set Parameters for newly created VM
vboxmanage modifyvm phd07 --ostype RedHat_64 --memory 8192 --cpus 6 --nic1 nat
# Storage Controller
vboxmanage storagectl phd07 --name "SATA1" --add sata --controller IntelAhci
# Attach a existing disk
vboxmanage storageattach phd07 --storagectl "SATA1" --port 0 --device 0 --type hdd --medium "/vhdd/vbox2.vdi"
# Set up port forwarding
vboxmanage modifyvm phd07 --natpf1 "guestssh,tcp,,2222,,22"
vboxmanage modifyvm phd07 --natpf1 "psql,tcp,,5432,,5432"
vboxmanage modifyvm phd07 --natpf1 "phdcc,tcp,,5000,,5000"
# If you need RDP support
vboxmanage modifyvm phd07 --vrde on --vrdemulticon on --vrdeport 3389 --vrdeauthtype external
VBoxManage setextradata phd07 "VBoxAuthSimple/users/gpadmin" 0fb25430a453886e1ae6974205cb89a7abfe6d7b4e308f5346f407977f83a513
# Kick off the VM in headless mode
vboxmanage startvm phd07 --type headless
# APPENDIX
# Shutdown & Delete the VM - p.s. this deletes config files and the attached disk
vboxmanage controlvm phd07 poweroff
vboxmanage unregistervm phd07 --delete
# Monitor VMs
vboxmanage list runningvms
vboxmanage showvminfo phd07
#download virtualbox extension pack for enabling vrde
http://download.virtualbox.org/virtualbox/4.2.16/Oracle_VM_VirtualBox_Extension_Pack-4.2.16-86992.vbox-extpack
# Enable VRDE simpleauth (the username and password stored in the local config file itself)
VBoxManage setproperty vrdeauthlibrary "VBoxAuthSimple"
VBoxManage internalcommands passwordhash "gpadmin"
vboxmanage clonehd -format vdi "Virtual Disk.vmdk" vbox2.vdi
Reference : http://stdioe.blogspot.com/2012/01/creating-virtual-machine-with.html
//shell/8305