Script to extract the date/time from a NIST source, and set the local Windows system clock

UpworkCANot specifiedintermediateScore: 32
Microsoft Windows PowerShellMicrosoft WindowsScriptingSystem AdministrationWindows AdministrationAutomation
This task is likely just a few hours for development and testing. I would like to have a Powershell script written that will fetch the date & time from a NIST source, either via ntp protocol, or other means, to the millisecond. I want the script to calculate how much time my local Windows clock is off by, and then print the result. An example of an implementation like this can be found on the home page of "time.gov". Scroll down the page a little. On the right hand side, you'll see the label: "Your clock is off by". The calculation that this page performs, also accounts for network latency. The script should output the result of the calculation, and optionally (via a command line argument flag), adjust the local system time appropriately using the command: "Set-Date -Adjust ". The correctness of the code written will be measured against whether the millisecond offset of the local Windows time is "close" to what time.gov calculates. Note that for every refresh of the time.gov page, the JavaScript code within it doesn't always sample the system time. Sometimes you need to wait a few minutes before it'll resample the local time and recalculate the offset.
View Original Listing
Unlock AI Intelligence, score breakdowns, and real-time alerts
Upgrade to Pro — $29.99/mo