Skip to content

Instantly share code, notes, and snippets.

@yogendra
Forked from thedom85/timeSync.bat
Last active June 6, 2016 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogendra/19a1dab4920dd800e1cce7452d0f35de to your computer and use it in GitHub Desktop.
Save yogendra/19a1dab4920dd800e1cce7452d0f35de to your computer and use it in GitHub Desktop.
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on
net start w32time
@echo =============================================
@echo Tell the time sync service to use the changes
w32tm /config /update
@echo =======================================================
@echo Reset the local computer's time against the time server
w32tm /resync /rediscover
@endlocal & @goto :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment