header image

Time oddity

Posted by: | August 7, 2013 | 1 Comment |

I was looking for a test of time synchronisation on domain controllers and knew that the .NET domain controller object held a system property. So, I cam up with this

$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$dom.DomainControllers | Format-Table Name, CurrentTime

What I didn’t realise was that the CurrentTime given by this object reads GMT not your local time. OK, technically its UTC but as I live in the UK its GMT Smile

When you are testing for time synchronisation all you want is differences so the absolute time doesn’t matter so much. If you need the system time as local time

Get-CimInstance -ClassName Win32_OperatingSystem | select LocalDateTime

will find it for you

under: Active Directory, PowerShell and .NET, PowerShell and WMI, PowerShell original

1 Comment

  1. By: Chris Warwick on August 8, 2013 at 5:41 am      

    Hi Richard,

    You may find these scripts useful to read NTP time from DCs: