6

No matter what, a Hyper-V virtual machine keeps finding ways to sync time with the host.

I have:

  • Disabled the time synchronization service
  • Disabled Windows time synchronization on the guest machine
  • mapped time.windows.com to 127.0.0.1 on the hosts file on the guest machine
  • used the Security Policy console to remove all users from being able to set date and time

What's interesting here, is that somehow Windows resets the last point (security policy) and adds back LOCAL SERVICE to the list of users allowed to set date and time. This is a totally unexpected behavior to me.

Anything I am missing?

resle
  • 189
  • 1
  • 1
  • 9
  • `No matter what, a Hyper-V virtual machine keeps finding ways to sync time with the host` - Do you mean when the VM is running? Exactly how do you mean? – joeqwerty Feb 05 '18 at 00:42
  • Yes, while the VM is running. The Security Policy workaround would prevent any change, I tested it also on a real machine: even upon reboot, Windows is unable to sync the date using the bios clock. The culprit here seems to be whatever periodically resets the Security Policy I set, by adding back LOCAL SERVICE arbitrarily to the list of users being able to set date and time. – resle Feb 05 '18 at 01:19
  • 1
    Are you sure that it's syncing to the host and not to another NTP server that happens to have the same time as your host? – pxed Feb 05 '18 at 16:33
  • 1
    I am not sure what is it syncing to. As I said, I disabled syncing to NTP servers in general (on the guest), through the trivial windows setting "set date and time automatically". My guess is that some Windows process still tries to take date and time periodically from the BIOS clock. The only way to prevent that, is to disable LOCAL SERVICE from being able to set date and time. But some *other* process seems to re-enable this, periodically as well. – resle Feb 05 '18 at 23:49

5 Answers5

4

How about unchecking Time synchronization option in Integration Services under VM settings? enter image description here

batistuta09
  • 8,723
  • 9
  • 21
3

Hyper-V guests always synchronize time with the host on BIOS level during boot. Try to specify the time zone properly, otherwise you can manage time in Active Directory.

You can check the following link: https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/11/19/time-synchronization-in-hyper-v/

Hope it helps.

Stuka
  • 5,181
  • 13
  • 11
  • 1
    Hi Stuka. Thanks, I am aware of the boot time sync. However I was able to disable it. Again, by removing LOCAL SERVICE from the users allowed to set date and time, through the Security Policies console. The only problem is that the user keeps being added again automatically at some point *after boot time*. (I don't understand the suggestion about time zone as I am skipping time zone entirely, in fact I want to freeze time. Also, I don't have an active directory at all) – resle Feb 06 '18 at 13:07
  • I am not sure that there is any way to completely freeze time in Hyper-V, but if it exists, I wanna warn you that it can highly affect your VM because almost all the services and applications are dealing with the Windows date&time service. You can find steps for completely disabling time synchronization by following the link below: https://www.experts-exchange.com/questions/26453055/How-to-change-the-BIOS-time-on-a-Hyper-v-guest-vm-without-changing-host's-time.html – Stuka Feb 09 '18 at 16:29
  • the provided link offers no solution. It lists one basic thing mentioned several times (disable time integration services), and a couple entirely wrong suggestions as Hyper V machines have no boot-time bios settings. – resle Feb 10 '18 at 00:06
1

For anyone still looking for this answer, there are 2 services in the VM that need to be stopped - "Windows Time" and "Hyper-V Time Synchronization Service". When I stop (and disable) both of these services then I'm able to set the clock in my VM and it doesn't get reset, even after a reboot.

MDK
  • 11
  • 1
  • Not for me. Even with this being disabled, the machine still somehow syncs at times. Note that the VM in question is running Windows 10 – resle Feb 12 '19 at 11:54
1

In addition to the answer that suggests to stop "Windows Time" and "Hyper-V Time Synchronization Service", I found that you not only need to stop it, but to deactivate the "Windows time" service. If not it will be restarted.

0

Very old question, but I found the solution! After disabling and stopping time services, restart your VM. Now the time stays changed for good.

FYI to change date easily, just to "date 6/20/2020" on cmd console

Evelyn
  • 9
  • 2