Virtualization, Cloud, Infrastructure and all that stuff in-between

My ramblings on the stuff that holds it all together

How to set a Virtual Machine to a date in the past and make it stay there

From time to time you may have a requirement to set the time and date of a virtual machine to a date in the past, to replicate a time-sensitive production issue or to work around expiry of a temporary license key.

WARNING: DO NOT DO THIS WITH A MACHINE WITH ANY SORT OF CONNECTIVITY TO THE OUTSIDE NETWORK – you could get into a world of pain, and some applications don’t work well if you move the time around if they do some sort of internal comparison – so use at your own risk!!

In my case – I had some configuration information stored in an eval build of a product that had since expired installed inside a VM and I wanted to be able to extract it, I was unable to do this without running the application as it was in a proprietary format so I needed temporary access to that application.

The steps that worked for me are:

  • Disconnect the VM network from the outside world – in my case I was using Fusion and put it on a host-only network.
  • Disable any application services (SQL, etc.) to avoid confusing them too much
  • Disable the Windows time service (start/run/services.msc and disable the “Windows Time Service”)
  • Disable Windows updating its time over the Internet (otherwise it uses NTP to update itself periodically)
    • image 
    • Disable VMtool time sync
      • image
    • Disable the VMtools Service – I found if you don’t do this it still updates the time, even with all the other settings in this post!
      • image 
      • Shutdown the virtual machine
      • Remove the virtual machine from the Fusion inventory
          • image 
          • Choose to keep the file
          • image
        • Open the .VMX file (On Fusion you’ll need to show package for the .vmwarevm file)
          • image
        • Locate the .vmx file and open it in a text editor
        • Add the following .VMX entries (calculate YourValue using this calculator this will set the VM BIOS to start at this date when you reboot the VM)
          • rtc.startTime = "YourValue"
            tools.syncTime = "FALSE"
            time.synchronize.continue ="FALSE"
            time.synchronize.restore = "FALSE"
            time.synchronize.resume.disk = "FALSE"
            time.synchronize.resume.memory = "FALSE"
            time.synchronize.shrink = "FALSE"

            (note: if you have more than one tools.syncTime=”FALSE” entry in your .VMX file remove one of them)

        • Save the .vmx file and re-open it with Fusion (if you don’t remove it from the inventory 1st it doesn’t seem to work correctly)
        • Start-up the VM and the system time should be set to a date in the past (that you specified in epoch seconds in YourValue above)
        • If the time does not stick, set the Windows time to a point shortly after your intended time and power off he VM, it should then stick.
        • Re-enable the application services (SQL etc.) that you require.
        • Use with caution to extract files/data.

 

Credit to this post for the original .vmx entries

2 responses to “How to set a Virtual Machine to a date in the past and make it stay there

  1. Sabrina October 23, 2012 at 4:08 am

    You mean “YourValue” what format I need to put it in M/D/Y, or M.D.Y or D.M.Y or D/M/Y

  2. bob December 14, 2017 at 3:19 am

    Very helpful. A couple comments:

    1: in windows 2008 there was a task called Time Sync, it was setup to run once a week so I deleted it just in case.

    2: In order to re-enable the VMware tools I had to add the following:

    time.synchronize.tools.startup = “FALSE”
    time.synchronize.tools.enable = “FALSE”
    time.synchronize.resume.host = “FALSE”

    source: https://blogs.vmware.com/apps/2016/01/completely-disable-time-synchronization-for-your-vm.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: