Time Stamp is one hour behind

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

[pre]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[/pre]

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

Thanks in advance

Brad

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.

[pre]

> 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

[/pre]

Thank you.