# Managing NTP on Windows clients

## Forcing a resynchronization on a windows workstation

Run the command w32tm /resync /nowait in a shell with admins rights to force the local NTP service of the Windows client to synchronize its clock with the NTP server. If all goes well, the command returns The command ended correctly).

Note

an NTP server must be given some time before asking for its time, otherwise it declares itself to be an unreliable source.

### In the event of a problem

The service is called w32time while the management tool is called w32tm. You may also need the commands net and time.

## Reconfiguring the domain’s Windows clients to synchronize their clocks with Samba-AD’s NTP

On the Windows client, run the following instructions:

    w32tm /config /syncfromflags:domhier
    w32tm /config /update
    w32tm /resync /nowait

## Debugging the NTP service on a Windows client

To define a log file to debug the operation of the NTP service on a Windows client, the following registry keys can be defined:

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
    "FileLogSize"=dword:01000000
    "FileLogName"="c:\\w32time_debug.txt"
    "FileLogEntries"="0-300"

For more information, visit this article from Microsoft [http://support.microsoft.com/kb/816043/en-us].

## Choosing the operating mode of the Windows NTP client

There are two operating modes of the Windows NTP client, Nt5DS and named.

The standard operating mode of a Windows client registered in the domain is Nt5DS.

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
    ...
    "Type"="Nt5DS"

If for some reason you prefer to switch to the named operating mode, do net time /setsntp:ad.mydomain.lan, which should return:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
    ...
    "Type"="NTP"
    "ntpserver"="ad.mydomain.lan"

If you have chosen this mode, make sure the client is pointing to the correct NTP server. If the DHCP gave an NTP server that is not the domain controller, this may be a problem. To check, use the command w32tm /monitor.