#!/bin/bash # # Delete Encryption Key/Cert # if [ "$UID" -eq 0 ] then echo "This script should NOT be run as root." exit 1 fi # if [ $# -ne 1 ]; then echo "Usage for $0 : VM Name required as argument." exit 1 fi # # Virtual Machine Name VB_VM_NAME=$1 # # Check if VM is powered-off VM_POWERED_ON=`VBoxManage list runningvms|grep -c '^"'${VB_VM_NAME}'"'` if [ $VM_POWERED_ON -eq 1 ]; then echo "VM needs to be powered off or saved" exit 1 fi # VBoxManage modifyvm $VB_VM_NAME \ --vrdeproperty "Security/Method=" VBoxManage modifyvm $VB_VM_NAME \ --vrdeproperty "Security/CACertificate=" VBoxManage modifyvm $VB_VM_NAME \ --vrdeproperty "Security/ServerCertificate=" VBoxManage modifyvm $VB_VM_NAME \ --vrdeproperty "Security/ServerPrivateKey=" # VBoxManage showvminfo ${VB_VM_NAME}|grep Security # exit