Time Stamp is one hour behind

Welcome Forums General PowerShell Q&A Time Stamp is one hour behind

Viewing 1 reply thread
  • Author
    Posts
    • #183501
      Inactive
      Topics: 1
      Replies: 0
      Points: 5
      Rank: Member

      Hi All

      I'm new to powershell so I'm finding my feet with it at the moment, I'm trying to capture when a users password expires amongst other things.

      I have the following line of code however when returning "Passwordexpires" the time stamp is one hour behind, I have verified this by checking net user

      Get-ADUser -Filter {Name -like $search} -Properties "Name", "passwordlastset", "Passwordneverexpires", "passwordexpired", "LockedOut", "msDS-UserPasswordExpiryTimeComputed" | Sort-Object | Select Name, passwordlastset, @{Name="Passwordexpires";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}, Passwordneverexpires, passwordexpired, LockedOut

      I have also tried using FromFileTimeUtc as well but the result is still the same?

      Thanks in advance

      Brad

    • #184296
      Participant
      Topics: 2
      Replies: 135
      Points: 708
      Helping Hand
      Rank: Major Contributor

      Hi there,

      I didn't see any issue here, I ran it in my test lab, and it workd fine. Please check your system datetime and timezone as well.

      
      > Get-ADUser -Filter {Name -eq "Test User"} -Properties "Name", "passwordlastset", "Passwordneverexpires", "passwordexpired", "LockedOut", "msDS-UserPasswordExpiryTimeComputed" | Select Name, passwordlastset, @{Name="Passwordexpires";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}, Passwordneverexpires, passwordexpired, LockedOut
      
      Name : Test User
      passwordlastset : 22-10-2019 08:31:36
      Passwordexpires : 03-12-2019 08:31:36
      Passwordneverexpires : False
      passwordexpired : False
      LockedOut : False
      
      

      Thank you.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.