How to reset W32Time to sync time with the domain

Author: NetworkAdminKB.com
Created: 2009-12-13
Modified: 2009-12-13

Issue:

Computers no longer synchronize time from the domain correctly.

 

Cause:

Many computers in the domain have been configured to manually sync with an incorrect NTP server.

 

Solution:

Windows 2000

Set time source to domain (set type=NT5DS)

w32tm /config /computer:<computer> /syncfromflags:DOMHIER

 

To get W32Time to recognize the changes and sync time with the Domain, Stop and Start the service

SC \\<computer> stop W32Time

SC \\<computer> start W32Time

 

Windows 2003

Set time source to domain (set type=NT5DS) and update configuration

w32tm /config /computer:<computer> /syncfromflags:DOMHIER /Update

 

Sync with the domain time source

w32tm /resync /computer:<computer> /nowait /rediscover

 

Use the following batch file to correct multiple computers quickly.

 

@Echo Off

REM   Author: NetworkAdminKB.com

REM  Created: 2009-12-08

REM Modified: 2009-12-08

REM  Purpose: Batch to remotely update the W32Time configuration for a list of servers.

REM

REM    Files:

REM    w32tm.exe  - Used to issue resync command to remote w32time computer.  Available on WinXP.

REM   timout.exe  - Used to delay processing.  Available on Win2k3.

REM

REM    Notes:

REM      Assumes Windows 2000 or Windows 2003/XP computers only.

REM      Configures W32Time to sync with the domain.

REM

REM Variables:

REM   %1 = Server List filename

 

SetLocal

If '%1' == '' Goto Syntax

Set RNDFile=Temp%Random%.txt

 

For /F %%a in (%1) Do Call :Loop %%a

Goto End

 

:Loop

REM %1 is the server name

Echo ******** %1 ********

Reg query \\%1\HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters /v ServiceDLL >%RNDFile% 2>&1

If Errorlevel 1 Goto ErrorORWin2k

:Win2003

Echo Windows 2003 detected.

W32tm /config /computer:%1 /syncfromflags:domhier /update

w32tm /config /computer:%1 /Update

w32tm /resync /computer:%1 /nowait /rediscover

Goto :EOF

 

:ErrorORWin2k

Type %RNDFile% | Find /I "unable to find the specified registry key" >Nul

If Errorlevel 1 (

Type %RNDFile%

Goto :EOF

)

Goto :Win2k

 

:Win2k

Echo Windows 2000 detected.

W32tm /config /computer:%1 /syncfromflags:domhier /update

SC \\%1 query W32Time | Find /I "RUNNING"

If Errorlevel 1 Goto :EOF

SC \\%1 Stop W32Time

timeout /t 5 /nobreak

SC \\%1 Start W32Time

Goto :EOF

 

 

:Syntax

Echo Syntax:

Echo %0 Serverlist

Echo     Serverlist  = A file with a list of computer names.

Echo.

Echo Example:

Echo   %0 Servers.txt

Echo.

Pause

 

:End

Del %RNDFile% /f

EndLocal

 

 

More Information:

How to configure an authoritative time server in Windows 2000

How to configure an authoritative time server in Windows Server

Registry entries for the W32Time service

Windows Time Service Tools and Settings

Configuring the Windows Time Service for Windows Server

Article ID: 231, Created On: 9/18/2011, Modified: 9/18/2011