add to a ntp registry, set default WO deleting any other ntp
Posted: 18 Sep 2015 10:14
I asked this question in stackoverflow http://stackoverflow.com/questions/32555877/add-to-a-ntp-registry-and-set-default-without-deleting-any-other-ntp-servers and unfortunately no one has responded, so then I thought dostips has always helped in the past, perhaps someone knows.
I needed to add an IP into the list of internet time servers in the date and time applet (internet time tab) and set that as the default via command line script. After exhaustive research over honestly a number of years I finally came up with the correct command line. It took so long to find the answer because simply adding to the registry never made it appear in the applet. Below is the code.
However, there is one issue I face because of this. This deletes whatever timeserver that was currently "1". What can I do to prevent this from happening? Cause usually the first entry is time.windows.com which is not something I want to delete.
To give an example of what my current date and time has in the registry when I export to .reg file
I needed to add an IP into the list of internet time servers in the date and time applet (internet time tab) and set that as the default via command line script. After exhaustive research over honestly a number of years I finally came up with the correct command line. It took so long to find the answer because simply adding to the registry never made it appear in the applet. Below is the code.
Code: Select all
Reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers /v "1" /t REG_SZ /d "192.16.1.2" /f
However, there is one issue I face because of this. This deletes whatever timeserver that was currently "1". What can I do to prevent this from happening? Cause usually the first entry is time.windows.com which is not something I want to delete.
To give an example of what my current date and time has in the registry when I export to .reg file
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers]
@="1"
"1"="time.windows.com"
"2"="time.nist.gov"
"3"="time-nw.nist.gov"
"4"="time-a.nist.gov"
"5"="time-b.nist.gov"