Fix NTP configuration before running the service (#72)

Co-authored-by: Marc05 <git@marc05.net>
This commit is contained in:
Marc05
2021-08-20 17:21:08 +00:00
committed by GitHub
parent 0a857aa09e
commit 71e70e50c5

View File

@@ -4342,23 +4342,23 @@ actions:
code: |-
:: Configure time source
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
:: Restart time service if running
:: Stop time service if running
SC queryex "w32time"|Find "STATE"|Find /v "RUNNING">Nul||(
net stop w32time
net start w32time
)
:: Sync now
:: Start time service and sync now
net start w32time
w32tm /config /update
w32tm /resync
revertCode: |-
:: Configure time source
w32tm /config /syncfromflags:manual /manualpeerlist:"time.windows.com"
:: Restart time service if running
:: Stop time service if running
SC queryex "w32time"|Find "STATE"|Find /v "RUNNING">Nul||(
net stop w32time
net start w32time
)
:: Sync now
:: Start time servie and sync now
net start w32time
w32tm /config /update
w32tm /resync
-