From 177a7084680275dda66c796a5f31d290bc34186d Mon Sep 17 00:00:00 2001 From: "Michael H.G. Schmidt" Date: Tue, 18 Apr 2023 21:19:19 +0200 Subject: [PATCH] timeserver script fixed --- scripts/modify-timeservers.cmd | 49 +++++++++++++++++++--------------- scripts/set-filetypes.cmd | 2 +- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/scripts/modify-timeservers.cmd b/scripts/modify-timeservers.cmd index 2ccb160..fd155e7 100644 --- a/scripts/modify-timeservers.cmd +++ b/scripts/modify-timeservers.cmd @@ -1,31 +1,36 @@ @echo off +set POLLTIME=7f16f25 +set TIME1=ptbtime1.ptb.de +set TIMESERVERS=ptbtime2.ptb.de ptbtime3.ptb.de 0.europe.pool.ntp.org ^ + 1.europe.pool.ntp.org 2.europe.pool.ntp.org 3.europe.pool.ntp.org + echo ####### %0 ####### -echo adding PTB time servers ... -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "1" /t REG_SZ /d "ptbtime1.ptb.de" /f +setlocal enabledelayedexpansion +set /a counter=1 +for %%T in ( + %TIME1% %TIMESERVERS% +) do ( + echo adding Timeserver [ %%T ] with index [ !counter! ] to registry... + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ + /v "!counter!" /t REG_SZ /d "%%T" /f >nul + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ + /v "!counter!" /t REG_SZ /d "%%T" /f >nul + set /a counter+=1 +) -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "2" /t REG_SZ /d "ptbtime2.ptb.de" /f - -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "3" /t REG_SZ /d "ptbtime3.ptb.de" /f - - -echo adding EUROPE ntp pool servers ... -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "4" /t REG_SZ /d "0.europe.pool.ntp.org" /f - -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "5" /t REG_SZ /d "1.europe.pool.ntp.org" /f - -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "6" /t REG_SZ /d "2.europe.pool.ntp.org" /f - -reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" ^ - /v "7" /t REG_SZ /d "3.europe.pool.ntp.org" /f +echo setting poll time... +reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" ^ + /v "SpecialPollTimeRemaining" /t REG_SZ /d "%TIME1%,%POLLTIME%" /f >nul +reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W32Time\TimeProviders\NtpClient" ^ + /v "SpecialPollTimeRemaining" /t REG_SZ /d "%TIME1%,%POLLTIME%" /f >nul +echo setting server address... +reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W32Time\Parameters" ^ + /v "NtpServer" /t REG_SZ /d "%TIME1%,0x9" /f >nul +reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W32Time\Parameters" ^ + /v "NtpServer" /t REG_SZ /d "%TIME1%,0x9" /f >nul echo stopping time service ... sc stop W32Time 1:3:3 1>nul diff --git a/scripts/set-filetypes.cmd b/scripts/set-filetypes.cmd index 9b791de..e440bba 100644 --- a/scripts/set-filetypes.cmd +++ b/scripts/set-filetypes.cmd @@ -1,6 +1,6 @@ @echo off -set %TOOLS%=%SystemDrive%\tools +set TOOLS=%SystemDrive%\tools set ARG1=null IF "%~1" NEQ "" set ARG1=%1