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