The other day I got a client asking for help syncing time across all Windows 10 thin clients with their NTP server. After taking a walk around NYC and witnessing many hanging shoes I refreshed my head I found a useful way to check Windows NTP configuration using the command prompt.
Using w32tm To Check and configure NTP using the Command Prompt
In Windows 10 open your command prompt and type the below command to check your current NTP configuration:
w32tm /query /configuration
The above gives you the current time configuration.
w32tm /query /status
The above shows you many more details, such as: stratum, precision, last sync, NTP server and etc..
time /T
This last one shows the current time.
At some Windows10 machines I got the below error:
The following error occurred: The service has not been started. (0x80070426)
This means the time service has is not running or disabled. I made sure to enabled accordingly either using the command prompt:
net start w32time
or at the services window when the above did not work:
There’s also a way to set and start Windows NTP configuration using the command prompt this way:
w32tm /config /manualpeerlist:10.0.0.5 /syncfromflags:manual /reliable:yes /update
Then, as usual Windows stays problematic. I had to run the below commands in sequence:
w32tm /unregister
w32tm /register
net start w32time
I did all these because I found out by running:
net time /querysntp
I got the deprecated error:
The /QUERYSNTP and /SETSNTP options have been deprecated. Please use w32tm.exe to configure the Windows Time Service.
At the end of the config you might need to run:
w32tm /config /update
w32tm /resync /rediscover
To make Windows 10 rediscover its NTP settings. Play around, research the official Windows documentation. You can also place all these command on a batch file and deploy it to all your clients.
Good luck! Contact me if you have any questions. Remember to check out my IT Handyman shop for cool T-Shirts and coffee mugs I designed once in a while.
Рассмотрим ситуацию, когда вам необходимо синхронизировать время вашей Windows машине или Windows сервере с вашим NTP сервером, или внешне доступным сервером времени. Задача простая, но у новичков в системном администрировании это может вызвать некоторые трудности. Так давайте разберемся!
Небольшое отступление: синхронизировать время на всех узлах сети (сервера, рабочие станции, сетевое оборудование, sip телефоны и т.д.) с единым сервером времени является обязательным, для корректной работы всех служб и сервисов в корпоративной сети. Так, например, это необходимо для корректной работы служб Active Directory, контроллеров доменов, почтовых серверов, рабочих станций, обеспечения корректных прав доступа и безопасности.
Операционные системы семейства Windows содержат службу времени W32Time. Эта служба предназначена для синхронизации времени в пределах организации. W32Time отвечает за работу как клиентской, так и серверной части службы времени, причем один и тот же компьютер может быть одновременно и клиентом и сервером NTP (NTP — Network Time Protocol).
Для того чтобы синхронизировать ваш сервер или рабочую станцию вам необходимо выполнить следующие команды, в командной строке (CMD), запущенной от имени администратора:
1. w32tm /query /source – проверяем источник, на который настроена служба времени в данный момент. Вывод команды либо покажет нам имя или адрес существующего ntp сервера, или в случае его отсутствия выдаст “Free-running System Clock”.
2. w32tm /config /syncfromflags:manual /manualpeerlist:”source” – данной командой указываем источник эталонного времени (NTP Сервер) . Заменяем source на ip адрес или на FQDN. В доменной сети стоит указывать адрес контроллера домена. В случае правильности выполнения получим вывод “Команда выполнена успешно”.
3. w32tm /config /update – обновляем службу времени, чтобы новые настройки применились.
4. w32tm /resync – запускаем принудительное обновление с новым сервером времени.
Все. Вы синхронизировали службу времени на вашей машине с внешним источником. Данный подход позволит вам добиться того, что все машины в вашей сети будет иметь единое правильное время, что позволит избежать ряда сбоев из за расхождения во времени.
Дополнительные команды управления службой времени:
w32tm /query /source — выводит источник времени, на который настроена служба Windows Time
w32tm /monitor — при запуске на контроллере домена (КД) показывает, насколько отличается время на других КД и на внешнем источнике времени, на который настроен PDC
w32tm /config /syncfromflags:manual /manualpeerlist:ru.pool.ntp.org — настройка в качестве источника времени пула ntp-серверов ru.pool.ntp.org
w32tm /config /update — эту команду необходимо выполнить, чтобы служба времени применила новые настройки
w32tm /resync — выполнение синхронизации времени
w32tm /unregister — отменяет регистрацию службы и удаляет настройки из реестра
w32tm /register — регистрирует службу и восстанавливает настройки по умолчанию
Всем привет! Сегодня я расскажу, как синхронизация времени с контроллером домена, чтобы компьютеры нормально работали с AD. Если время у разных компьютеров будет отличаться хотя бы на 5 минут, то могут возникнуть проблемы с работой некоторых программных модулей.
Содержание
- Через параметры
- Синхронизация с помощью командной строки
- Видео
- Задать вопрос автору статьи
Через параметры
Вообще вам необязательно делать синхронизацию через команду строку или любым другим способом, так как операционная система Windows сама это делает, если у вас правильно настроен домен синхронизации. Давайте проверим это:
Читаем – чем Виндовс 11 лучше 10-ой версии.
- Перейдите в «Параметры» через меню «Пуск».
- Найдите раздел «Время и язык».
- В первом разделе слева, в правом блоке можно просто нажать «Синхронизировать». Выше также будет отображаться сервер времени, который используется в данный момент.
Обратите внимание также, чтобы был правильно установлен «Часовой пояс». Галочку установки автоматического времени лучше включить, но вот пояс лучше ставить вручную. Дата аналогично ставится исходя из сервера.
Синхронизация с помощью командной строки
Также есть дополнительные команды для работы с w32tm. На официальном сайте Microsoft сказано, что устаревшие команды «Net time» – использовать не рекомендуется. Вместо этого используем w32tm и дополнительными атрибуты. Напишу пару примеров.
w32tm /query /source – выводит текущий сервер, с которого идет синхронизация.
w32tm /config /syncfromflags:manual /manualpeerlist: “АДРЕС_СЕРВЕРА” – принудительно указать адрес сервера, с которым будет идти синхронизация времени.
w32tm /config /update – обновляет конфигурационный файл времени.
w32tm /resync /rediscover – выполнить синхронизацию прямо сейчас.
Чтобы синхронизировать время с сервером делаем следующее:
w32tm /query /configuration
Проверяем чтобы в строке «Type» было значение «NT5DS» – это значит, что синхронизация идет с помощью домена AD. Если у вас не так и стоит NTP (локальная синхронизация), то сбрасываем настройки до NT5DS:
w32tm /config /syncfromflags:domhier /update net stop w32time && net start w32time
После этого система сама найдет домен с сервером в иерархии AD и подключиться к нему. Если подключиться не получается. То прописываем команду отмены регистрации и удаления конфига:
w32tm /unregister
Восстанавливаем конфигурацию обратно, как было в настройках:
w32tm /register
Синхронизируем время обратно с Active Directory:
w32tm /config /syncfromflags:domhier /update
Службу теперь надо перезагрузить:
net stop w32time && net start w32time
Апгрейдим настройки:
w32tm /config /update
И теперь можно синхронизировать само время:
w32tm /resync
Проверьте, чтобы служба была запущена и сервер правильно определился:
w32tm /query /status
Основная проблема – это ошибка, что служба не запущена. В таком случае зайдите в «Службы» операционной системы, найдите «Службу времени Windows» и запустите её вручную. После этого уже можно вводить команды дальше. До новых встреч на портале WiFiGiD.RU.
Видео
Skip to content
Every desktop computer keeps the correct time even when it is turned off by using a simple 3V Lithium battery cell (CR2032). But this is not a rechargeable battery cell, so it stops working after a year or so. You can easily replace this cell, but after replacing the cell, you have to update the time using the NTP servers so that your Windows PC keeps the accurate time. You can update the time using Windows graphical user interface and also through a command line interface (CLI). The CLI method works even when the time service is not properly configured in Windows.
Here is how you can sync time with NTP servers in Windows using the command line interface:
- Open an elevated command prompt. In Windows 8 and later versions, you can press the hotkey Win+X and choose Command Prompt (Admin) from the menu that shoes up. For earlier versions of Windows, you can search our side about opening elevated command prompt in Windows.
- In the elevated command prompt window, type the following commands. At the end of each line, press Enter to issue that command:
w32tm /register
sc start W32Time
w32tm /config /update /manualpeerlist:”pool.ntp.org” - These commands will register Windows Time service if it is not registered for some reason, start this service, change the time server to “pool.ntp.org” and finally sync the computer time with the NTP server. Obviously, instead of “pool.ntp.org”, you can change the time server to any time server of your choice.>
You can also download update-time-windows.zip, extract the contents to Windows desktop, right-click on update-time-windows.cmd and choose Run as administrator. This will automatically run a batch file containing all the necessary commands for syncing the time.
Conclusion: Using command line interface or a batch file to sync the Windows PC time with a remote NTP server can be useful when you have to update it frequently. The reasons for frequent syncing could be a failing battery or dual boot operating systems having different time zones set.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Download Windows Speedup Tool to fix errors and make PC run faster
Internet Server Time is used to keep your system clock accurate and thus it is very important to keep your internet time updated. Your Windows PC uses the clock to update and modify your files. While the Date & Time settings for Windows are pretty easy to access, to access the Timer Server settings, one has to go through the control panel. In this post, we see how to change Time Server in Windows 11/10. We will also see how to add new Time Servers of your choice to your Windows 10 system.
Type “Control Panel” in Start search and hit Enter to open the Control Panel of your Windows 11/10 PC.
Type “Date and Time” in the search box and click on the result.
Click on the ‘Internet Time’ tab and hit on the ‘Change Settings’ button.
From the drop-down menu, select, say, time.nist.gov as the Server and hit the ‘Update now’ button.
If you receive any error, try using pool.ntp.org as your time server and then hit the Update Now button.
Make sure you select the checkbox saying, Synchronize with an internet time server.
Add new Time servers to Windows 11/10
If you want to add more time servers to the drop-down list, open Registry Editor and go to the below path-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
This will show you the list of current servers available-time.windows.com
- time-nist.gov
- time-nw.nist.gov
- time-a.nist.gov
- time-b.nist.gov
If you wish to add Time Servers, you could use the following for instance, or any other one of your choice:
- pool.ntp.org
- isc.org
Just select the server you want to add, right-click anywhere on the right side and select New > String Value. Enter the next number and give the Time server’s address in the Value field.
Once done, go back to the Date and Time settings, select your server and click on Update Now button.
Force Windows to sync Time using CMD
You can also force Windows to sync Time using W32tm.exe. W32tm.exe is a command prompt line used to configure, monitor or troubleshoot the Windows Time Service in Windows 11/10.
To do this, open an elevated command prompt and type the following commands one after the other:
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync
Reboot your computer and see if it has helped.
Also read: Windows Clock Time is wrong.
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.