Skip to content

Instantly share code, notes, and snippets.

@wehappyfew
Last active February 10, 2016 10:37
Show Gist options
  • Save wehappyfew/a19307b4b8bfbddfd924 to your computer and use it in GitHub Desktop.
Save wehappyfew/a19307b4b8bfbddfd924 to your computer and use it in GitHub Desktop.
Start and stop a Virtualbox VM from Python
# start the vm
subprocess.call(["C:\Program Files\Oracle\VirtualBox\VBoxManage.exe", "startvm", "Win7-IE8"])
time.sleep(50)
# stop a vm
# -set inside the VM from the 'control panel->power options' the os to shutdown when the power button is pressed-
subprocess.call(["C:\Program Files\Oracle\VirtualBox\VBoxManage.exe",
"controlvm",
"WIN7IE8",
"acpipowerbutton"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment