Skip to content

Instantly share code, notes, and snippets.

@breautek

breautek/startvm.sh

Created Dec 20, 2018
Embed
What would you like to do?
VM Start with specific Date time (linux host/windows guest)
#The directory that contains VBoxManage
vbox_path="/usr/bin/"
#This should be your VM name
vm_name="<YOUR_VM_NAME>"
#Use http://epochconverter.com to find the desired time
start_utc=1489325734
#DO NOT CHANGE ANYTHING BELOW THIS LINE
now_utc=`date +%s`
diff_utc=$((start_utc*1000 - now_utc*1000))
echo "START UTC:" $start_utc " DIFF UTC:" $diff_utc " NEW UTC:" $now_utc
cd $vbox_path
./VBoxManage setextradata $vm_name "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "0"
./VBoxManage setextradata $vm_name "VBoxInternal/TM/TSCTiedToExecution" 1
./VBoxManage modifyvm $vm_name --biossystemtimeoffset $diff_utc
./VBoxManage startvm $vm_name
@Noir-

This comment has been minimized.

Copy link

@Noir- Noir- commented May 3, 2019

You can change $vm_name to "$vm_name" to fix issues with special characters like whitespaces in the name of the VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment