Created
December 20, 2018 14:07
-
-
Save breautek/be83414034b973d53691645d6e178bb4 to your computer and use it in GitHub Desktop.
VM Start with specific Date time (linux host/windows guest)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can change
$vm_name
to"$vm_name"
to fix issues with special characters like whitespaces in the name of the VM.