Skip to content

Instantly share code, notes, and snippets.

@rogersguedes
Created August 15, 2019 17:28
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 rogersguedes/787f6a4c661ba920d283668d82d79c6d to your computer and use it in GitHub Desktop.
Save rogersguedes/787f6a4c661ba920d283668d82d79c6d to your computer and use it in GitHub Desktop.
Sets the date in a VirtualBox VM given a time offset in seconds.
#!/bin/bash
#thanks to https://winaero.com/blog/how-to-set-the-bios-date-in-virtualbox/
if [[ -z ${1} || -z ${2} ]]
then
echo ${0} " Usage:"
echo " ${0} <vm-name> <time-offset>"
echo " Example: ${0} projectVM -36000000"
exit
fi
VBoxManage setextradata "${1}" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
VBoxManage modifyvm "${1}" --biossystemtimeoffset "${2}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment