sync server time ntp

Synchronize the server time with NTP by Bas Wijdenes

Let’s synchronize your device with a Network Time Protocol server.

The tutorial consists of 2 parts:

  • The short version of Synchronize server time with NTP for the system administrators among us
  • The extended version of Synchronize server time with NTP for the hobbyists among us.

Both tutorials are the same, and the extended version contains screenshots.


Synchronize server time with NTP for the system administrators among us.

Go to start and search for Command Prompt.
Right-click Command prompt and open the application as Administrator. (MOUSECLICK + CTRL + SHIFT will also open it as Administrator).

Type the following:

w32tm /config /manualpeerlist:YOURSERVERNAME /syncfromflags:manual /reliable:yes /update

Where YOURSERVERNAME is your device name.

Now stop the w32time service with the following command:

Net stop w32time

And then restart the service again with:

Net start w32time

Now your device should be updated with the time zone.
See the screenshot below for more clarity.

Synchronize server time with a Network Time Protocol (NTP).
Synchronize server time with a Network Time Protocol (NTP).

Synchronize server time with NTP for the hobbyists among us.

Go to start and search for Command Prompt.
Click Command Prompt with right mouse click and choose Run as Administrator.

We cannot update the server time without running Command Prompt (CMD) as Administrator.

Synchronize server time with a Network Time Protocol (NTP).

We will use the Windows Time Service for the NTP synchronization, this is called W32time in Command Prompt.

Run the following command in CMD:

w32tm /config /manualpeerlist:YOURSERVERNAME /syncfromflags:manual /reliable:yes /update

Where YOURSERVERNAME is your device name.

Synchronize server time with a Network Time Protocol (NTP).
Synchronize server time with a Network Time Protocol (NTP).

If you see “The command completed successfully.” scroll to the next step.

If you get the following error message:

The following error occurred: The service has not been started. (0x80070426)

Then your time service has not started yet. This can also cause the time difference.
Start the W32time service with the following command in Command Prompt:

Net start w32time

Then repeat the step above.

The following error occurred: The service has not been started. (0x80070426)
Net start w32time – The following error occurred: The service has not been started. (0x80070426)

Now all we have to do is restart the w32time.

Now stop the w32time service with the following command:

Net stop w32time

And then restart the service again with:

Net start w32time
Synchronize server time with a Network Time Protocol (NTP).
Synchronize server time with a Network Time Protocol (NTP).

Recap

This post has been renewed on November 27, 2018. The post itself dates from February 4, 2017.
The content has been changed in such a way that the post has been re-published.

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell DevOps Engineer. In my spare time I write about interesting stuff that I encounter during my work.

One thought on “Synchronize the server time with NTP by Bas Wijdenes”

  1. I am getting this error in a domain environment

    If you get the following error: “The following error occurred: The service has not been started. (0x80070426)”

    what shall i do. I didnt uderstand when you said please continue

Leave a Reply

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