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)
- Disable VMtool time sync
- 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!
- Shutdown the virtual machine
- Remove the virtual machine from the Fusion inventory
- Open the .VMX file (On Fusion you’ll need to show package for the .vmwarevm file)
- 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)
- 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.
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)
Credit to this post for the original .vmx entries
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
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