What to do if your PI does not sync with time server?

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




Raspberry PI does not have built in battery, which would keep board clock running and in sync with world clock. However if running Windows IOT Core, the operative system would sync time by using NTP. For most scenarios time is event not that important, but when it comes to security it is crucial to have very precise clock.
For example, imaging your application needs to transfer telemetry data to some cloud service, like EventHub or IoTHub. To do this your code will have to authenticate with the service. Every authentication operation includes some sort of encryption, which will fail if the board time is not correctly set.

If the firewall blocks NTP (Port 123) You can do following:

net start winrm

Set-Item WSMan:\localhost\Client\TrustedHosts –Value 192.168.0.XY

Enter-PSSession -ComputerName -Credential Administrator

Set-Date 01/26/2014

// Setting of the date will usually set a time to 12:00 AM and you will need to adjust it to correct time:
Set-Date -adjust 09:01:00

Posted Jan 26 2016, 09:18 AM by Damir Dobric


Damir Dobric wrote re: What to do if your PI does not sync with time server?
on 02-21-2016 15:09

On Raspberry we can also use 'w32tm /resync /force' from a PowerShell command line to force update its local time.

Because time-sync can sometimes take a while (minutes) to sync though from power up, we can use 'w32tm /resync /force' from a PowerShell to enforce update of a local time.

Optionally ,we can even schedule a resync on boot by running:

schtasks /Create /SC ONSTART /TN TimeSync /TR "w32tm /resync /force"

from a PowerShell logon to make a hard reset the default.

Indraneel wrote re: What to do if your PI does not sync with time server?
on 04-11-2016 16:13

The correct command to connect to Pi is -

Enter-PSSession -ComputerName <machine-name or IP Address> -Credential <machine-name or IP Address or localhost>\Administrator


developers.de is a .Net Community Blog powered by daenet GmbH.