Author Posts

July 17, 2015 at 5:55 am

$domain = [directoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$result = $domain.FindAllDomainControllers() | select-object name,IPaddress,currenttime

When i run this code the output of current time in DC is showing 1 hour difference
I am trying to get my Domain controller time information

July 17, 2015 at 5:59 am

If you are showing a 1 hour time difference check that all of your machines – client and DC are in the correct time zone AND that there isn't any differences in the daylight savings time settings. I'd suspect that one or more machines aren't set correctly to manage daylight savings changes

Any reason you're not using the AD cmdlets rather than .NET classes?

July 17, 2015 at 7:34 am

Richard, thanks for your quick response
daylight settings and times are set correctly
If you could let me know the AD cmdlet for similar to .NET classes that would be so helpful

July 17, 2015 at 9:51 am

Check out Get-ADDomainController. I don't know how the the .NET method is providing the time, but you could try a script like this one and just replace the Get-ADComputer with the Get-ADDomainController and valid the timezones across all of the systems.