Skip to content

Instantly share code, notes, and snippets.

@breautek
Created December 20, 2018 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breautek/be83414034b973d53691645d6e178bb4 to your computer and use it in GitHub Desktop.
Save breautek/be83414034b973d53691645d6e178bb4 to your computer and use it in GitHub Desktop.
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-
Copy link

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