Last active
March 17, 2020 10:30
-
-
Save samqi/e0fcada6383fa166d899d18cbb72082b to your computer and use it in GitHub Desktop.
virtualbox cli command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List virtual machines | |
VBoxManage list vms | |
"MyVM" {wwwwww-4301-4a7d-8af8-fe02fed00451} | |
# Start VM in headless mode | |
VBoxManage startvm MyVM --type headless | |
# Power off VM | |
VBoxManage controlvm MyVM poweroff | |
#show details | |
VBoxManage showvminfo MyVM | |
############################### | |
#create virtualbox with a script | |
# http://www.digitesters.com/manage-a-virtualbox-headless-system-create-a-vm-with-a-script/ | |
############################### | |
# Get IP Address from Virtualbox VMs | |
# https://forums.virtualbox.org/viewtopic.php?f=1&t=36592 | |
#show ip from interface 1 | |
VBoxManage guestproperty get "MyVM" "/VirtualBox/GuestInfo/Net/0/V4/IP" | |
#show ip from interface 2 | |
VBoxManage guestproperty get "MyVM" "/VirtualBox/GuestInfo/Net/1/V4/IP" | |
#or | |
VBoxManage guestproperty enumerate MyVMb|grep IP | |
################################## | |
# for newer encrypted Virtualbox, you can use this after stasrting server headless | |
VBoxManage controlvm "vmname" addencpassword "vmname" "/home/user/vm-name-password" | |
## export ova https://www.techrepublic.com/article/how-to-import-and-export-virtualbox-appliances-from-the-command-line/ | |
vboxmanage export vmname -o vmname.ova |
Author
samqi
commented
Jul 25, 2019
From https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html:
VBoxManage list ostypes
VBoxManage storagectl $VM --name "IDE Controller" --add ide
VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium "C:\VM\ISO\ubuntu-18.04.2-live-server-amd64.iso"
VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none
VBoxManage modifyvm $VM --nic1 bridged --bridgeadapter1 e1000g0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment