Hi there,
I just did this batch file that will simultaniously SET the time on the network computers.
If I remove the ping delay line, it is faster, but I get misc errors.
For example, I some times get findstr file not found...
I need to improve this batch file so the simultanious execution is faster, without the errors.
Thanks,
Rene
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET LogFile=%~n0.log
SET TmpFolder=%~dp0%~n0_TMP
IF EXIST "%TmpFolder%" RD /s /q "%TmpFolder%"
IF NOT EXIST "%TmpFolder%" MD "%TmpFolder%"
IF EXIST "%LogFile%" DEL "%LogFile%"
FOR /F "delims=" %%T in ('TIME /t') DO SET TheTime=%%T
FOR /F "delims=\ " %%A IN ('NET VIEW ^| FINDSTR -i "\\" ^| FINDSTR -i -v "%computername%"') DO (
SET BatchFile=%TmpFolder%\%%A.bat
ECHO %%A
ECHO psexec \\%%A cmd /c time %TheTime%>>"%LogFile%"
ECHO psexec \\%%A cmd /c time %TheTime%>>"!BatchFile!"
ECHO EXIT>>"!BatchFile!"
START "SET NETWORK TIME" /min "!BatchFile!"
PING -n 1 -w 10 10.0.0.0 >NUL
)
EXIT
Open in new window
I did try "NET TIME \\TIMESRV /SET /YES".
But the time on few non domain controller servers, keeps going back to + or - 1h.
PS: We are located at -5 GMT and time shifted 1h this weekend.
Have any ideas?
Cheers,
Rene