Skip to content

Instantly share code, notes, and snippets.

@pettazz
Last active November 9, 2020 09:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pettazz/4947662 to your computer and use it in GitHub Desktop.
Save pettazz/4947662 to your computer and use it in GitHub Desktop.
bash script for deleting and re-cloning VirtualBox VMs from existing base images
#!/bin/bash
function reset_vm {
echo -e "\e[0;32m\n\nresetting $1...\n\n\e[00m"
echo -e "\e[0;34mpoweroff\e[00m"
vboxmanage controlvm "$1 - active" poweroff
sleep 5s
echo -e "\e[0;34munregister\e[00m"
vboxmanage unregistervm "$1 - active" --delete
echo -e "\e[0;34mclone\e[00m"
vboxmanage clonevm "$1 Base" --name="$1 - active" --register
echo -e "\e[0;34mstart\e[00m"
vboxmanage startvm "$1 - active"
echo -e "\e[0;32m\n\ndone.\n\n\e[00m"
}
reset_vm "Win7 ie8"
reset_vm "Win7 ie9"
reset_vm "Win7 ff,chrome"
echo -e "\e[0;32m\n\ndone.\n\n\e[00m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment