Help Required on this Script

This topic contains 4 replies, has 3 voices, and was last updated by  NajeethKumar MM 2 years, 3 months ago.

  • Author
    Posts
  • #27611

    NajeethKumar MM
    Participant

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

    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

  • #27613

    Richard Siddaway
    Moderator

    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?

  • #27629

    NajeethKumar MM
    Participant

    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

  • #27643

    Rob Simmers
    Participant

    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.

  • #27667

    NajeethKumar MM
    Participant

    Thank You Rob

You must be logged in to reply to this topic.