<#
.Synopsis
Helper function to perform the clock Drift test
.DESCRIPTION
Helper function to perform the clock Drift test
.EXAMPLE
Test-ClockDrift
#>
function Test-ClockDrift
{
# Get the clock drift by testing it aginst the google ntp service, one sample only.
$timeDifference = w32tm.exe /stripchart /dataonly /computer:time.google.com /samples:1
# The returned result is a string, split the string and get the time only.
$clockDriftString = $timeDifference[3].Split(',')[1]
# Remove any non-numeric characters.
$clockDriftString = ($clockDriftString -Replace "[^0-9]{2}").Replace('s','').Replace(',','.')
# Cast the string to decimal and round it to two decimals, this will also return the results.
[Math]::Round(([decimal]$clockDriftString),2)
}
This will compare the current machines clock with the NTP source you state in the command line.
Just modify it with whatever source (or parameterize it) you need etc.
Accurate when it comes to NTP will always be a question on how accurate you need it to be
E.g. the above will only grab one sample, to get a better result you probably want to grab multiple samples and do an average on those.
When I wrote the above I only needed a ballpark figure just to see if it was completely out of wack (someone had reconfigured the PDC FSMO role on the wrong DC).