Checking and changing the source time server on a VM or host has never been easier than running a simple command to change it.

Many times, VM’s and hosts lose time and you end up with Services like Exchange or domain controllers out of sync and then stuff stops working.

To firstly check where your VM or host is getting its time from is by querying the status of w32tm by running this command:

  • w32tm /query /status
Windows powershell:- changing time on a server

As you can see above, this server I am working on is getting its time from “time.windows.com”

Now to change the time, you can run the following command:

  • w32tm /config /syncfromflags:manual /manualpeerlist:”NTP Server” /reliable:yes /update
Windows powershell:- changing time on a server

As shown above, the command ran successfully, change the name NTP Server to the peer you want to use.

Now if you run the first command again, you will see the change. I normally restart the time service once done.

Hope it helps.

    wpChatIcon

    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading