I've tried to understand w32tm and net time commands looking at ss64 but I haven't figured out anything. Networking lingo is not fortay.
What I have found: topic here: https://groups.google.com/forum/#!topic ... pvUnYfxBkw
The topic is a description on how to do what I'm asking for except, it uses a deprecated cmd, because when i try
Code: Select all
net time /setsntp:time.nist.gov,0x1
Code: Select all
The /QUERYSNTP and /SETSNTP options have been deprecated. Please use w32tm.ex
to configure the Windows Time Service.
In the last thread of this topic I found the code below which I'm guessing just checks to see if the server is available, which of course would be useful but not the whole answer. I'm unable to test it here. Does anyone have access to a server to test?
Code: Select all
@echo off
setlocal enabledelayedexpansion
color 0a
for /f "tokens=1 delims= " %%a in ('net view^|findstr "\\"') do (
ping -n 1 %%~na|Find "TTL=" >nul && (call :checktime %%a) || echo %%~na *Offline*
)
goto :eof
:checktime
for /f "tokens=2 delims=:" %%c in ('w32tm /monitor /computers:%~n1^|find "NTP:"') do (
for /f "tokens=1" %%d in ("%%~nc") do (
set n=%%d
if !n:~-1! GTR 2 echo %1 : %%c
)
)
Thanks for any help / suggestions!
Jules