I have a PLC running windows embedded standard where I make some installations and modifications specific to my company's software as part of our installation process (which is all manual today). I'm now in the process of automating this procedure.
I want to set the Date and time properties->internet time server to pool.ntp.org through a batch file or similar. The command
w32tm
is not recognized. I've tried using the command
net time /setsntp:pool.ntp.org
which returns
the command completed succefully.
.
Using the command
net time /querysntp
also returns
The current SNTP value is: pool.ntp.org
The command completed successfully.
But these changes are not reflected when I manually check them under Date and time properties->internet time server, not even after a restart. So I'm left wondering if the command I'm using is actually working? Is there another way to accomplish this?
EDIT:
The following .bat file works. The changes in the registry alone only added the server to the list and made it default but it didn't enable syncing.
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers /v "0" /t REG_SZ /d "pool.ntp.org" /f
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers /ve /d "0" /f
NET TIME /setsntp:pool.ntp.org