Window Date and Time settings

Fix time drift on UTM Windows VM

I mainly use Mac for work, but occasionally need access to a Windows box. I am using UTM to achieve that. I have noticed that if you leave your Windows VM running and then your host Mac goes to sleep (overnight for example), there will be a time drift on the VM. So here is how to fix time drift on UTM Windows VM.

Discovery and manual approach

The first thing I checked was if the time is set automatically, and yes it is

Then I tried to turn it off/on – and it helped! It fixed the time drift on the UTM Windows VM.

But that only lasted until the next time MAC went to sleep… 🙁

Semi-automatic approach

While toggling the switch using Windows UI I noticed that a pop-up message was displayed

That gave me an idea: instead of manually toggling the time switch, why don’t I run the above command?! Hmm, but what kind of parameters should I use?

Luckily there was the “Show more details” link.

So, I put the below command inside a batch file and every time I access the UTM Windows VM I just run it manually.

it.C:\Windows\System32\SystemSettingsAdminFlows.exe SetInternetTime 1

While not a fully an automatic approach it saves me from going into Time settings and toggling the switch.

How to automatically fix time drift on UTM Windows VM

Now if you want a fully hands-off approach just create a scheduled job to run this batch for you.

You could either do it on a scheduled basis, like let’s say every 5 minutes, or better on a certain “wake-up” Windows event. Once I figure out what is the best event to use as the trigger I’ll update this section.

More posts about UTM

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.