Using virtual box is it possible to set your virtual machine time to be different from host time

66,627

Solution 1

It's no problem at all. Just remember to disable the time synchronisation in the VirtualBox Guest Additions, then set the date+time in the virtual machine as you like. There is also an option to go into the Virtual BIOS and set the date+time there, if that's needed at install time.

This command disables the synchronization:
http://www.virtualbox.org/manual/ch09.html#disabletimesync

VBoxManage setextradata "VM name" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1

The following option allows to set an offset in milliseconds: http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvm

VBoxManage modifyvm "VM name" --biossystemtimeoffset <msec>

Solution 2

Example of a windows powerShell script

startVM.ps1

# Starts the VM always on the date 12/30/2016

$tempo = ""+([datetime]"12/30/2016" - [datetime]::Now).TotalMilliseconds
$tempo = ""+[math]::Round($tempo)
$nome = "virtualMachineName"

& ${env:ProgramFiles}\Oracle\VirtualBox\VBoxManage setextradata $nome "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1

& ${env:ProgramFiles}\Oracle\VirtualBox\VBoxManage modifyvm $nome --biossystemtimeoffset $tempo

& ${env:ProgramFiles}\Oracle\VirtualBox\VBoxManage startvm $nome
Share:
66,627
nelaaro
Author by

nelaaro

Linux admin, tech enthusiast. opensource evangelist.

Updated on September 18, 2022

Comments

  • nelaaro
    nelaaro almost 2 years

    Using virtual box is it possible to set your virtual machine time to be different from host time. Say 1 year into the past.

    If I wanted to run the windows XP images provided by Microsoft from here.
    http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11575

    It is noted for the XP image that:

    Expires: This image will shutdown and become completely unusable on February 14, 2013.

    It is one of the better ways to test IE 6, and IE 7. Other XP typical tests.

  • nelaaro
    nelaaro over 11 years
    Ok how do you do that.
  • Stefan Seidel
    Stefan Seidel over 11 years
    Do what? Please be more specific?
  • nelaaro
    nelaaro over 11 years
    disable the time synchronisation & go into the Virtual BIOS and set the date+time there
  • Stefan Seidel
    Stefan Seidel over 11 years
    Disable time sync: there's a checkbox in the VirtualBox Guest Additional. Alternatively: virtualbox.org/manual/ch09.html#disabletimesync For the BIOS: hit F12 (I think) during the VM startup, and here are command line tools described: betaarchive.com/forum/viewtopic.php?t=20071 on how to change the BIOS time.
  • Raul Lapeira Herrero
    Raul Lapeira Herrero about 3 years
    Any idea on why would this not work?, I tried using 2011 and 2012 as the year